dap-design-system 0.61.4 → 0.61.6
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/components/breadcrumb/breadcrumb.component.js +22 -25
- package/dist/components/breadcrumb/breadcrumb.component.js.map +1 -1
- package/dist/components/breadcrumb-item/breadcrumb-item.component.d.ts +8 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.component.js +24 -20
- package/dist/components/breadcrumb-item/breadcrumb-item.component.js.map +1 -1
- package/dist/components/breadcrumb-item/breadcrumb-item.scss.js +1 -1
- package/dist/components/button/_styles/button.scss.js +1 -1
- package/dist/components/button/button.component.d.ts +64 -9
- package/dist/components/button/button.component.js.map +1 -1
- package/dist/components/datepicker/datepicker.component.d.ts +3 -3
- package/dist/components/datepicker/datepicker.component.js +59 -56
- package/dist/components/datepicker/datepicker.component.js.map +1 -1
- package/dist/components/stack/stack.component.d.ts +2 -0
- package/dist/components/stack/stack.component.js +23 -19
- package/dist/components/stack/stack.component.js.map +1 -1
- package/dist/components/stack/stack.scss.js +1 -1
- package/dist/components/tooltip/tooltip.scss.js +1 -1
- package/dist/components.native.css +160 -76
- package/dist/components.native.css.map +1 -1
- package/dist/manifest/types/vue/index.d.ts +327 -325
- package/dist/manifest/vscode.html-custom-data.json +316 -311
- package/dist/manifest/web-types.json +472 -462
- package/dist/react/dap-ds-button/index.d.ts +64 -9
- package/dist/react/dap-ds-button/index.js.map +1 -1
- package/dist/react/dap-ds-datepicker/index.d.ts +1 -1
- package/dist/react/dap-ds-datepicker/index.js.map +1 -1
- package/dist/react/index.d.ts +12 -12
- package/dist/react-types.ts +13 -13
- package/dist/react.js +146 -146
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.component.js","sources":["../../../src/components/button/button.component.ts"],"sourcesContent":["import clsx from 'clsx'\nimport { nothing, PropertyValueMap, unsafeCSS } from 'lit'\nimport { property, query } from 'lit/decorators.js'\nimport { ifDefined } from 'lit/directives/if-defined.js'\nimport { html, unsafeStatic } from 'lit/static-html.js'\n\nimport { GenericFormElement } from '@/internal/mixin/genericFormElement'\nimport { t } from '@/localization/localization'\n\nimport {\n ButtonShape,\n ButtonVariant,\n HtmlButtonType,\n LinkTarget,\n} from '../../common/types'\nimport DapDSIcon from '../icon/icon.component'\nimport { ButtonSize } from '../icon-button/icon-button.component'\nimport SystemLoadingSpinner from '../icons/system/system-loading-spinner/system-loading-spinner.component'\nimport styles from './_styles/button.scss?inline'\nimport { buttonVariants } from './button.variants'\n\nconst LOADING_ICON_SIZES = {\n lg: 24,\n md: 20,\n sm: 16,\n xs: 16,\n} as const\n\n/**\n * `dap-ds-button` is a versatile button component for triggering actions and navigation.\n * @element dap-ds-button\n * @summary A button is a clickable element that can be used to trigger an action, submit forms, or navigate to other pages.\n * @title - Button\n *\n * @example Basic Usage\n * ```html\n * <dap-ds-button>Click me</dap-ds-button>\n * <dap-ds-button variant=\"outline\">Secondary action</dap-ds-button>\n * <dap-ds-button href=\"/dashboard\">Navigate</dap-ds-button>\n * ```\n *\n * @example Form Integration\n * ```html\n * <form>\n * <dap-ds-button htmlType=\"submit\">Submit Form</dap-ds-button>\n * <dap-ds-button htmlType=\"reset\" variant=\"outline\">Reset</dap-ds-button>\n * </form>\n * ```\n *\n * @example Accessibility\n * ```html\n * <!-- Icon-only buttons require aria-label -->\n * <dap-ds-button aria-label=\"Close dialog\" shape=\"circle\">\n * <dap-ds-icon name=\"close-line\"></dap-ds-icon>\n * </dap-ds-button>\n * ```\n *\n * @property {string} sizeMap - The size map of the button.\n * @example\n * ```html\n * <dap-ds-button sizeMap=\"sm:lg,xs:xs\">Small</dap-ds-button>\n * ```\n *\n * @event dds-loading-timeout - Emitted when the loading timeout is reached\n *\n * @slot - The content of the button. Can contain text, icons, or other elements.\n *\n * @csspart base - The main button container.\n * @csspart high-contrast - The high contrast part of the button.\n * @csspart content - The content wrapper inside the button.\n *\n * @cssproperty --dds-button-padding-x - Horizontal padding of the button (default: var(--dds-spacing-300))\n * @cssproperty --dds-button-padding-y - Vertical padding of the button (default: var(--dds-spacing-300))\n * @cssproperty --dds-button-border-radius - Border radius of the button (default: var(--dds-radius-rounded))\n * @cssproperty --dds-button-font-weight - Font weight of the button (default: 700)\n * @cssproperty --dds-button-line-height - Line height of the button (default: var(--dds-font-line-height-large))\n * @cssproperty --dds-button-transition - Transition property of the button (default: all 0.2s ease-in-out)\n * @cssproperty --dds-button-disabled-opacity - Opacity of disabled button (default: 0.5)\n *\n * @cssproperty --dds-button-size-lg - Size of large button (default: var(--dds-spacing-1200))\n * @cssproperty --dds-button-size-md - Size of medium button (default: var(--dds-spacing-1000))\n * @cssproperty --dds-button-size-sm - Size of small button (default: var(--dds-spacing-800))\n * @cssproperty --dds-button-size-xs - Size of extra small button (default: var(--dds-spacing-600))\n *\n * @cssproperty --dds-button-circle-lg - Size of large circle button (default: var(--dds-spacing-1200))\n * @cssproperty --dds-button-circle-md - Size of medium circle button (default: var(--dds-spacing-1000))\n * @cssproperty --dds-button-circle-sm - Size of small circle button (default: var(--dds-spacing-800))\n * @cssproperty --dds-button-circle-xs - Size of extra small circle button (default: var(--dds-spacing-600))\n *\n * Primary button properties:\n * @cssproperty --dds-button-primary-color-bg - Background color of primary button (default: var(--dds-button-primary-background-enabled))\n * @cssproperty --dds-button-primary-color-bg-hover - Background color of primary button on hover (default: var(--dds-button-primary-background-hover))\n * @cssproperty --dds-button-primary-color-bg-active - Background color of primary button when active (default: var(--dds-button-primary-background-pressed))\n * @cssproperty --dds-button-primary-color-bg-disabled - Background color of disabled primary button (default: var(--dds-button-primary-background-disabled))\n * @cssproperty --dds-button-primary-color-text - Text color of primary button (default: var(--dds-button-primary-text-enabled))\n * @cssproperty --dds-button-primary-color-text-disabled - Text color of disabled primary button (default: var(--dds-button-primary-text-disabled))\n *\n * Primary inverted button properties:\n * @cssproperty --dds-button-primary-inverted-color-bg - Background color of primary inverted button (default: var(--dds-button-primary-background-inverted-enabled))\n * @cssproperty --dds-button-primary-inverted-color-bg-hover - Background color of primary inverted button on hover (default: var(--dds-button-primary-background-inverted-hover))\n * @cssproperty --dds-button-primary-inverted-color-bg-active - Background color of primary inverted button when active (default: var(--dds-button-primary-background-inverted-pressed))\n * @cssproperty --dds-button-primary-inverted-color-bg-disabled - Background color of disabled primary inverted button (default: var(--dds-button-primary-background-inverted-disabled))\n * @cssproperty --dds-button-primary-inverted-color-text - Text color of primary inverted button (default: var(--dds-button-primary-text-inverted))\n * @cssproperty --dds-button-primary-inverted-color-text-disabled - Text color of disabled primary inverted button (default: var(--dds-button-primary-text-inverted-disabled))\n *\n * Outline button properties:\n * @cssproperty --dds-button-outline-color-border - Border color of outline button (default: var(--dds-button-outline-border-enabled))\n * @cssproperty --dds-button-outline-color-border-hover - Border color of outline button on hover (default: var(--dds-button-outline-border-hover))\n * @cssproperty --dds-button-outline-color-border-active - Border color of outline button when active (default: var(--dds-button-outline-border-pressed))\n * @cssproperty --dds-button-outline-color-border-disabled - Border color of disabled outline button (default: var(--dds-button-outline-border-disabled))\n * @cssproperty --dds-button-outline-color-text - Text color of outline button (default: var(--dds-button-outline-text-enabled))\n * @cssproperty --dds-button-outline-color-text-hover - Text color of outline button on hover (default: var(--dds-button-outline-text-hover))\n * @cssproperty --dds-button-outline-color-text-active - Text color of outline button when active (default: var(--dds-button-outline-text-pressed))\n * @cssproperty --dds-button-outline-color-text-disabled - Text color of disabled outline button (default: var(--dds-button-outline-text-disabled))\n *\n * Outline inverted button properties:\n * @cssproperty --dds-button-outline-inverted-color-border - Border color of outline inverted button (default: var(--dds-button-outline-border-inverted-enabled))\n * @cssproperty --dds-button-outline-inverted-color-border-hover - Border color of outline inverted button on hover (default: var(--dds-button-outline-border-inverted-hover))\n * @cssproperty --dds-button-outline-inverted-color-border-active - Border color of outline inverted button when active (default: var(--dds-button-outline-border-inverted-pressed))\n * @cssproperty --dds-button-outline-inverted-color-border-disabled - Border color of disabled outline inverted button (default: var(--dds-button-outline-border-inverted-disabled))\n * @cssproperty --dds-button-outline-inverted-color-text - Text color of outline inverted button (default: var(--dds-button-outline-text-inverted-enabled))\n * @cssproperty --dds-button-outline-inverted-color-text-hover - Text color of outline inverted button on hover (default: var(--dds-button-outline-text-inverted-hover))\n * @cssproperty --dds-button-outline-inverted-color-text-active - Text color of outline inverted button when active (default: var(--dds-button-outline-text-inverted-pressed))\n * @cssproperty --dds-button-outline-inverted-color-text-disabled - Text color of disabled outline inverted button (default: var(--dds-button-outline-text-inverted-disabled))\n *\n * Subtle button properties:\n * @cssproperty --dds-button-subtle-color-bg - Background color of subtle button (default: var(--dds-button-subtle-background-enabled))\n * @cssproperty --dds-button-subtle-color-bg-hover - Background color of subtle button on hover (default: var(--dds-button-subtle-background-hover))\n * @cssproperty --dds-button-subtle-color-bg-active - Background color of subtle button when active (default: var(--dds-button-subtle-background-pressed))\n * @cssproperty --dds-button-subtle-color-bg-disabled - Background color of disabled subtle button (default: var(--dds-button-subtle-background-disabled))\n * @cssproperty --dds-button-subtle-color-border - Border color of subtle button (default: var(--dds-button-subtle-border-enabled))\n * @cssproperty --dds-button-subtle-color-border-hover - Border color of subtle button on hover (default: var(--dds-button-subtle-border-hover))\n * @cssproperty --dds-button-subtle-color-border-active - Border color of subtle button when active (default: var(--dds-button-subtle-border-pressed))\n * @cssproperty --dds-button-subtle-color-border-disabled - Border color of disabled subtle button (default: var(--dds-button-subtle-border-disabled))\n * @cssproperty --dds-button-subtle-color-text - Text color of subtle button (default: var(--dds-button-subtle-text-enabled))\n * @cssproperty --dds-button-subtle-color-text-hover - Text color of subtle button on hover (default: var(--dds-button-subtle-text-hover))\n * @cssproperty --dds-button-subtle-color-text-active - Text color of subtle button when active (default: var(--dds-button-subtle-text-pressed))\n * @cssproperty --dds-button-subtle-color-text-disabled - Text color of disabled subtle button (default: var(--dds-button-subtle-text-disabled))\n *\n * Clean button properties:\n * @cssproperty --dds-button-clean-color-text - Text color of clean button (default: var(--dds-text-link-base))\n * @cssproperty --dds-button-clean-color-text-hover - Text color of clean button on hover (default: var(--dds-text-link-hover))\n * @cssproperty --dds-button-clean-color-text-active - Text color of clean button when active (default: var(--dds-text-link-pressed))\n * @cssproperty --dds-button-clean-color-text-disabled - Text color of disabled clean button (default: var(--dds-text-neutral-disabled))\n *\n * Clean inverted button properties:\n * @cssproperty --dds-button-clean-inverted-color-text - Text color of clean inverted button (default: var(--dds-button-primary-text-inverted))\n * @cssproperty --dds-button-clean-inverted-color-text-hover - Text color of clean inverted button on hover (default: var(--dds-button-primary-text-inverted))\n * @cssproperty --dds-button-clean-inverted-color-text-active - Text color of clean inverted button when active (default: var(--dds-button-primary-text-inverted))\n * @cssproperty --dds-button-clean-inverted-color-text-disabled - Text color of disabled clean inverted button (default: var(--dds-text-neutral-disabled))\n *\n * Danger button properties:\n * @cssproperty --dds-button-danger-color-bg - Background color of danger button (default: var(--dds-button-primary-background-destructive-enabled))\n * @cssproperty --dds-button-danger-color-bg-hover - Background color of danger button on hover (default: var(--dds-button-primary-background-destructive-hover))\n * @cssproperty --dds-button-danger-color-bg-active - Background color of danger button when active (default: var(--dds-button-primary-background-destructive-pressed))\n * @cssproperty --dds-button-danger-color-text - Text color of danger button (default: var(--dds-button-primary-text-enabled))\n * @cssproperty --dds-button-danger-outline-color-border - Border color of danger outline button (default: var(--dds-button-outline-border-destructive-enabled))\n * @cssproperty --dds-button-danger-outline-color-border-hover - Border color of danger outline button on hover (default: var(--dds-button-outline-border-destructive-hover))\n * @cssproperty --dds-button-danger-outline-color-border-active - Border color of danger outline button when active (default: var(--dds-button-outline-border-destructive-pressed))\n * @cssproperty --dds-button-danger-outline-color-text - Text color of danger outline button (default: var(--dds-button-outline-text-destructive-enabled))\n * @cssproperty --dds-button-danger-outline-color-text-hover - Text color of danger outline button on hover (default: var(--dds-button-outline-text-destructive-hover))\n * @cssproperty --dds-button-danger-outline-color-text-active - Text color of danger outline button when active (default: var(--dds-button-outline-text-destructive-pressed))\n * @cssproperty --dds-button-danger-subtle-color-bg - Background color of danger subtle button (default: var(--dds-button-subtle-background-destructive-enabled))\n * @cssproperty --dds-button-danger-subtle-color-bg-hover - Background color of danger subtle button on hover (default: var(--dds-button-subtle-background-destructive-hover))\n * @cssproperty --dds-button-danger-subtle-color-bg-active - Background color of danger subtle button when active (default: var(--dds-button-subtle-background-destructive-pressed))\n * @cssproperty --dds-button-danger-subtle-color-text - Text color of danger subtle button (default: var(--dds-button-subtle-text-destructive-enabled))\n * @cssproperty --dds-button-danger-subtle-color-text-hover - Text color of danger subtle button on hover (default: var(--dds-button-subtle-text-destructive-hover))\n * @cssproperty --dds-button-danger-subtle-color-text-active - Text color of danger subtle button when active (default: var(--dds-button-subtle-text-destructive-pressed))\n * @cssproperty --dds-button-danger-clean-color-text - Text color of danger clean button (default: var(--dds-text-negative-subtle))\n * @cssproperty --dds-button-danger-clean-color-text-hover - Text color of danger clean button on hover (default: var(--dds-text-negative-base))\n * @cssproperty --dds-button-danger-clean-color-text-active - Text color of danger clean button when active (default: var(--dds-text-negative-strong))\n */\nexport default class DapDSButton extends GenericFormElement {\n static override tagName = 'dap-ds-button'\n\n /** Components rendered inside the button, auto-registered on first use. */\n static override dependencies = {\n 'dap-ds-icon': DapDSIcon,\n 'dap-ds-icon-loading-spinner': SystemLoadingSpinner,\n }\n\n /**\n * @ignore\n */\n @query('.button') readonly button!: HTMLButtonElement | HTMLLinkElement\n\n /** The visual style variant of the button\n * @type { 'primary' | 'outline' | 'subtle' | 'subtle-neutral' | 'subtle-quiet' | 'subtle-quiet-inverted' | 'clean' | 'primary-inverted' | 'outline-inverted' | 'subtle-inverted' | 'clean-inverted' | 'subtle-menu' | 'subtle-menu-item' }\n * @default 'primary'\n * @example\n * ```html\n * <dap-ds-button variant=\"primary\">Primary action</dap-ds-button>\n * <dap-ds-button variant=\"outline\">Secondary action</dap-ds-button>\n * <dap-ds-button variant=\"subtle\">Tertiary action</dap-ds-button>\n * ```\n * @group Visual\n */\n @property({ reflect: true }) variant: ButtonVariant = 'primary'\n\n /** The size of the button affecting padding and font size\n * @type { 'lg' | 'md' | 'sm' | 'xs' }\n * @default 'md'\n * @example\n * ```html\n * <dap-ds-button size=\"xs\">Extra small</dap-ds-button>\n * <dap-ds-button size=\"sm\">Small</dap-ds-button>\n * <dap-ds-button>Medium (default)</dap-ds-button>\n * <dap-ds-button size=\"lg\">Large</dap-ds-button>\n * ```\n * @group Visual\n */\n @property({ reflect: true }) size: ButtonSize = 'md'\n\n /** Whether the button is in loading state, showing a spinner and disabling interaction\n * @default false\n * @example\n * ```html\n * <dap-ds-button loading>Submitting...</dap-ds-button>\n * ```\n * @group State\n */\n @property({ type: Boolean, reflect: true }) loading = false\n\n /** Whether the button represents a destructive action (applies danger styling)\n * @default false\n * @example\n * ```html\n * <dap-ds-button danger>Delete Account</dap-ds-button>\n * <dap-ds-button variant=\"outline\" danger>Remove Item</dap-ds-button>\n * ```\n * @group State\n */\n @property({ type: Boolean }) danger = false\n\n /** The shape of the button - use 'circle' for icon-only buttons\n * @type { 'button' | 'circle' }\n * @default 'button'\n * @example\n * ```html\n * <dap-ds-button shape=\"circle\" aria-label=\"Close\">\n * <dap-ds-icon name=\"close-line\"></dap-ds-icon>\n * </dap-ds-button>\n * ```\n * @group Visual\n */\n @property({ reflect: true }) shape: ButtonShape = 'button'\n\n /** The HTML type attribute for form interaction\n * @type { 'button' | 'submit' | 'reset' }\n * @default 'button'\n * @example\n * ```html\n * <form>\n * <dap-ds-button htmlType=\"submit\">Submit</dap-ds-button>\n * <dap-ds-button htmlType=\"reset\">Reset</dap-ds-button>\n * </form>\n * ```\n * @group Form\n */\n @property() htmlType: HtmlButtonType = 'button'\n\n /** The URL to navigate to. When present, the button renders as an anchor element\n * @example\n * ```html\n * <dap-ds-button href=\"/dashboard\">Go to Dashboard</dap-ds-button>\n * <dap-ds-button href=\"https://example.com\" target=\"_blank\">External Link</dap-ds-button>\n * ```\n * @group Navigation\n */\n @property() href?: string\n\n /** The target attribute for link navigation\n * @type { '_blank' | '_self' | '_parent' | '_top' }\n * @default '_self'\n * @example\n * ```html\n * <dap-ds-button href=\"https://example.com\" target=\"_blank\">Open in new tab</dap-ds-button>\n * ```\n * @group Navigation\n */\n @property() target: LinkTarget = '_self'\n\n /** The rel attribute for link security and behavior\n * @default 'noreferrer noopener'\n * @example\n * ```html\n * <dap-ds-button href=\"https://example.com\" rel=\"noopener\">Safe external link</dap-ds-button>\n * ```\n * @group Navigation\n */\n @property() rel?: string\n\n /** Controls loading timeout in milliseconds\n * @default 0\n * @group State\n */\n @property({ type: Number }) loadingTimeout = 0\n\n /** Enables high contrast theme toggle functionality (internal use)\n * @default false\n * @ignore\n */\n @property({ type: Boolean }) hc: boolean = false\n\n /** Whether the button is active\n * @default false\n * @example\n * ```html\n * <dap-ds-button active>Active</dap-ds-button>\n * ```\n */\n @property({ type: Boolean }) active: boolean = false\n\n /**\n * Enable OKLCH proof-of-concept theming (experimental)\n * @default false\n * @internal\n * @ignore\n */\n @property({ type: Boolean, attribute: 'data-oklch-poc', reflect: true })\n oklchPoc: boolean = false\n\n /** The text for the target blank link, applicable when target is _blank. PRO TIP: Use parenthesis to wrap the text */\n @property({ type: String }) targetBlankText: string\n\n /** Overrides the ARIA role on the internal native button/anchor element. Use when the host's semantics must differ from the native element (e.g. role=\"link\" on a button acting as a SPA navigation trigger). */\n @property({ type: String }) forceRole?: string\n\n static readonly styles = unsafeCSS(styles)\n\n private loadingTimer?: number\n\n /** Persisted aria-label for the inner button; host attribute is removed so we keep the value here */\n private _ariaLabelForButton: string | null = null\n\n /** Internal flag to ignore the aria-label change triggered by our own attribute cleanup */\n private _ignoreNextAriaLabelChange = false\n\n private getSecureRel(): string {\n if (this.target === '_blank') {\n return this.rel ?? 'noreferrer noopener'\n }\n return this.rel ?? ''\n }\n\n private validateAriaPressed(): string | undefined | null {\n if (\n this.ariaPressed &&\n !['true', 'false', 'mixed'].includes(this.ariaPressed)\n ) {\n console.warn('aria-pressed must be \"true\", \"false\", or \"mixed\"')\n return undefined\n }\n\n return this.ariaPressed\n }\n\n private getAriaExpanded(): string | null | undefined {\n if (this.ariaExpanded && !['true', 'false'].includes(this.ariaExpanded)) {\n console.warn('aria-expanded must be \"true\" or \"false\"')\n return undefined\n }\n return this.ariaExpanded\n }\n\n private validateProperties(): void {\n if (\n this.shape === 'circle' &&\n !this.effectiveAriaLabel &&\n !this.textContent?.trim() &&\n !this.ariaHidden\n ) {\n console.warn(\n 'Circle buttons require aria-label or visible text for accessibility',\n )\n }\n\n if (this.href && this.htmlType !== 'button') {\n console.warn(\n 'htmlType is ignored when href is provided - button will render as anchor',\n )\n }\n\n if (this.href && !this.isValidUrl(this.href)) {\n console.warn('Invalid URL provided for href attribute')\n }\n }\n\n private isValidUrl(url: string): boolean {\n try {\n if (\n url.startsWith('/') ||\n url.startsWith('./') ||\n url.startsWith('../')\n ) {\n return true\n }\n new URL(url)\n return true\n } catch {\n return false\n }\n }\n\n private handleClick(event: Event): boolean {\n if (this.disabled || this.loading) {\n // Returning false does not cancel a Lit listener, and an anchor has no\n // native disabled state, so without this a disabled href button navigates.\n event.preventDefault()\n event.stopPropagation()\n return false\n }\n\n let handled = false\n if (this.htmlType !== 'button') {\n const proxy = document.createElement('button')\n proxy.type = this.htmlType\n this.insertAdjacentElement('afterend', proxy)\n\n proxy.click()\n proxy.remove()\n handled = true\n }\n\n if (this.hc) {\n this.toggleHighContrast()\n }\n\n return handled\n }\n\n private handleKeyDown(event: KeyboardEvent): void {\n // Only handle keyboard events for anchor elements that act as buttons\n if (!this.href) {\n return\n }\n\n // WAI-ARIA: Elements acting as buttons must respond to Enter and Space keys\n if (event.key === ' ' || event.key === 'Enter') {\n if (this.disabled || this.loading) {\n event.preventDefault()\n event.stopPropagation()\n return\n }\n\n // For Space key: prevent default scrolling behavior and trigger click\n if (event.key === ' ') {\n event.preventDefault()\n event.stopPropagation()\n this.button.click()\n }\n }\n }\n\n private toggleHighContrast(): void {\n document.body.classList.toggle('high-contrast-theme')\n }\n\n private startLoadingTimeout(): void {\n if (this.loadingTimeout > 0) {\n this.loadingTimer = window.setTimeout(() => {\n this.loading = false\n this.emit(\n 'dds-loading-timeout',\n {\n timeout: this.loadingTimeout,\n },\n {\n bubbles: true,\n },\n )\n }, this.loadingTimeout)\n }\n }\n\n private clearLoadingTimeout(): void {\n if (this.loadingTimer) {\n clearTimeout(this.loadingTimer)\n this.loadingTimer = undefined\n }\n }\n\n /**\n * `this.button` is a `@query`, so it is null until Lit has rendered the shadow root.\n * A caller focusing a button the same tick it mounts -- a \"Save\" button that appears\n * only after the form it belongs to opens, say -- would otherwise get a TypeError,\n * not a no-op. Throwing out of a focus() call breaks whatever effect made it.\n */\n focus(options?: FocusOptions) {\n this.button?.focus(options)\n }\n\n blur() {\n this.button?.blur()\n }\n\n /**\n * @ignore\n */\n public get focusElement() {\n return this.button\n }\n\n /** Aria-label for the inner button; survives host attribute removal so Lit does not clear it */\n private get effectiveAriaLabel(): string | null {\n return this.ariaLabel ?? this._ariaLabelForButton\n }\n\n protected updated(\n changedProperties: Map<string | number | symbol, unknown>,\n ): void {\n super.updated(changedProperties)\n\n if (changedProperties.has('ariaLabel')) {\n const newValue = this.ariaLabel\n\n if (newValue != null && newValue !== '') {\n // Persist value before removing host attribute so the inner button keeps it\n this._ariaLabelForButton = newValue\n } else if (!this._ignoreNextAriaLabelChange) {\n // Only clear when the consumer explicitly removes/clears aria-label\n this._ariaLabelForButton = null\n }\n\n // Reset the guard after handling the change\n this._ignoreNextAriaLabelChange = false\n }\n\n if (this.ariaLabel != null && this.ariaLabel !== '') {\n // Removing the host attribute will trigger another ariaLabel change,\n // which we intentionally ignore so the inner button keeps its label.\n this._ignoreNextAriaLabelChange = true\n this.removeAttribute('aria-label')\n }\n\n if (changedProperties.has('loading')) {\n if (this.loading) {\n this.startLoadingTimeout()\n } else {\n this.clearLoadingTimeout()\n }\n }\n }\n\n protected firstUpdated(\n _changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>,\n ): void {\n super.firstUpdated(_changedProperties)\n this.validateProperties()\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback()\n this.clearLoadingTimeout()\n }\n\n render() {\n return html`\n <${unsafeStatic(this.href ? 'a' : 'button')}\n part=\"base\"\n .disabled=${this.disabled}\n aria-disabled=${this.disabled}\n aria-hidden=${ifDefined(this.ariaHidden)}\n aria-expanded=${ifDefined(this.getAriaExpanded())}\n aria-controls=${ifDefined(this.ariaControls)}\n aria-label=${ifDefined(this.effectiveAriaLabel)}\n aria-haspopup=${ifDefined(this.ariaHasPopup)}\n aria-describedby=${ifDefined(this.ariaDescribedBy)}\n aria-pressed=${ifDefined(this.validateAriaPressed())}\n role=${ifDefined(this.forceRole)}\n .autofocus=${this.autofocus}\n tabindex=${ifDefined(this.href && this.disabled ? '-1' : undefined)}\n type=${ifDefined(this.href ? null : this.htmlType)}\n name=${ifDefined(this.name)}\n href=${ifDefined(this.href)}\n target=${ifDefined(this.target)}\n rel=${ifDefined(this.getSecureRel())}\n class=${clsx(\n buttonVariants({\n intent: this.variant,\n size: this.effectiveSize as ButtonSize,\n shape: this.shape,\n }),\n {\n 'dds-button--danger': this.danger,\n 'dds-button--loading': this.loading,\n 'dds-button--active': this.active,\n // An anchor never reflects a disabled attribute, so the [disabled]\n // styling cannot reach it. Style off the class, as link--disabled does.\n 'button--disabled': this.disabled,\n },\n )}\n @click=${this.handleClick}\n @keydown=${this.handleKeyDown}>\n <div part=\"high-contrast\" class=\"button__highcontrast\"></div>\n ${\n this.loading\n ? this._getLoadingSpinner()\n : html` <span part=\"content\" class=\"button__text\">\n <slot></slot>\n </span>`\n }\n ${\n this.target === '_blank'\n ? html`<span class=\"sr-only\">\n ${this.targetBlankText ?? t('opensInNewTab')}</span\n >`\n : nothing\n }\n </${unsafeStatic(this.href ? 'a' : 'button')}>\n `\n }\n\n private getLoadingIconSize(size: ButtonSize): number {\n return LOADING_ICON_SIZES[size] || LOADING_ICON_SIZES.md\n }\n\n private _getLoadingSpinner() {\n return html`\n <span class=\"button__spinner\" aria-live=\"polite\">\n <dap-ds-icon-loading-spinner\n size=${this.getLoadingIconSize(this.effectiveSize as ButtonSize)}\n aria-label=${t('loading')}></dap-ds-icon-loading-spinner>\n </span>\n `\n }\n}\n"],"names":["LOADING_ICON_SIZES","_DapDSButton","GenericFormElement","_a","_b","url","e","event","handled","proxy","options","changedProperties","newValue","_changedProperties","html","unsafeStatic","ifDefined","clsx","buttonVariants","t","nothing","size","DapDSIcon","SystemLoadingSpinner","unsafeCSS","styles","DapDSButton","__decorateClass","query","property"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,MAAMA,IAAqB;AAAA,EACzB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAkJqBC,IAArB,MAAqBA,UAAoBC,EAAmB;AAAA,EAA5D,cAAA;AAAA,UAAA,GAAA,SAAA,GAyBwD,KAAA,UAAA,WAcN,KAAA,OAAA,MAUM,KAAA,UAAA,IAWhB,KAAA,SAAA,IAaY,KAAA,QAAA,UAcX,KAAA,WAAA,UAqBN,KAAA,SAAA,SAgBY,KAAA,iBAAA,GAMF,KAAA,KAAA,IASI,KAAA,SAAA,IAS3B,KAAA,WAAA,IAapB,KAAQ,sBAAqC,MAG7C,KAAQ,6BAA6B;AAAA,EAAA;AAAA,EAE7B,eAAuB;;AACzB,WAAA,KAAK,WAAW,YACXC,IAAA,KAAK,QAAL,OAAAA,IAAY,yBAEdC,IAAA,KAAK,QAAL,OAAAA,IAAY;AAAA,EAAA;AAAA,EAGb,sBAAiD;AAErD,QAAA,KAAK,eACL,CAAC,CAAC,QAAQ,SAAS,OAAO,EAAE,SAAS,KAAK,WAAW,GACrD;AACA,cAAQ,KAAK,kDAAkD;AACxD;AAAA,IAAA;AAGT,WAAO,KAAK;AAAA,EAAA;AAAA,EAGN,kBAA6C;AAC/C,QAAA,KAAK,gBAAgB,CAAC,CAAC,QAAQ,OAAO,EAAE,SAAS,KAAK,YAAY,GAAG;AACvE,cAAQ,KAAK,yCAAyC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,EAyEU,WAAA,OAAA;AAcjBC,EAAA;AAAA,EAAXE,EAAS;AAAA,GAvFSH,EAuFP,WAAA,UAAA;AAUAC,EAAA;AAAA,EAAXE,EAAS;AAAA,GAjGSH,EAiGP,WAAA,MAAA;AAWAC,EAAA;AAAA,EAAXE,EAAS;AAAA,GA5GSH,EA4GP,WAAA,QAAA;AAUAC,EAAA;AAAA,EAAXE,EAAS;AAAA,GAtHSH,EAsHP,WAAA,KAAA;AAMgBC,EAAA;AAAA,EAA3BE,EAAS,EAAE,MAAM,OAAQ,CAAA;AAAA,GA5HPH,EA4HS,WAAA,gBAAA;AAMCC,EAAA;AAAA,EAA5BE,EAAS,EAAE,MAAM,QAAS,CAAA;AAAA,GAlIRH,EAkIU,WAAA,IAAA;AASAC,EAAA;AAAA,EAA5BE,EAAS,EAAE,MAAM,QAAS,CAAA;AAAA,GA3IRH,EA2IU,WAAA,QAAA;AAS7BC,EAAA;AAAA,EADCE,EAAS,EAAE,MAAM,SAAS,WAAW,kBAAkB,SAAS,GAAM,CAAA;AAAA,GAnJpDH,EAoJnB,WAAA,UAAA;AAG4BC,EAAA;AAAA,EAA3BE,EAAS,EAAE,MAAM,OAAQ,CAAA;AAAA,GAvJPH,EAuJS,WAAA,iBAAA;AAGAC,EAAA;AAAA,EAA3BE,EAAS,EAAE,MAAM,OAAQ,CAAA;AAAA,GA1JPH,EA0JS,WAAA,WAAA;"}
|
|
1
|
+
{"version":3,"file":"button.component.js","sources":["../../../src/components/button/button.component.ts"],"sourcesContent":["import clsx from 'clsx'\nimport { nothing, PropertyValueMap, unsafeCSS } from 'lit'\nimport { property, query } from 'lit/decorators.js'\nimport { ifDefined } from 'lit/directives/if-defined.js'\nimport { html, unsafeStatic } from 'lit/static-html.js'\n\nimport { GenericFormElement } from '@/internal/mixin/genericFormElement'\nimport { t } from '@/localization/localization'\n\nimport {\n ButtonShape,\n ButtonVariant,\n HtmlButtonType,\n LinkTarget,\n} from '../../common/types'\nimport DapDSIcon from '../icon/icon.component'\nimport { ButtonSize } from '../icon-button/icon-button.component'\nimport SystemLoadingSpinner from '../icons/system/system-loading-spinner/system-loading-spinner.component'\nimport styles from './_styles/button.scss?inline'\nimport { buttonVariants } from './button.variants'\n\nconst LOADING_ICON_SIZES = {\n lg: 24,\n md: 20,\n sm: 16,\n xs: 16,\n} as const\n\n/**\n * `dap-ds-button` is a versatile button component for triggering actions and navigation.\n * @element dap-ds-button\n * @summary A button is a clickable element that can be used to trigger an action, submit forms, or navigate to other pages.\n * @title - Button\n *\n * @example Basic Usage\n * ```html\n * <dap-ds-button>Click me</dap-ds-button>\n * <dap-ds-button variant=\"outline\">Secondary action</dap-ds-button>\n * <dap-ds-button href=\"/dashboard\">Navigate</dap-ds-button>\n * ```\n *\n * @example Form Integration\n * ```html\n * <form>\n * <dap-ds-button htmlType=\"submit\">Submit Form</dap-ds-button>\n * <dap-ds-button htmlType=\"reset\" variant=\"outline\">Reset</dap-ds-button>\n * </form>\n * ```\n *\n * @example Accessibility\n * ```html\n * <!-- Icon-only buttons require aria-label -->\n * <dap-ds-button aria-label=\"Close dialog\" shape=\"circle\">\n * <dap-ds-icon name=\"close-line\"></dap-ds-icon>\n * </dap-ds-button>\n * ```\n *\n * @property {string} sizeMap - The size map of the button.\n * @example\n * ```html\n * <dap-ds-button sizeMap=\"sm:lg,xs:xs\">Small</dap-ds-button>\n * ```\n *\n * @event dds-loading-timeout - Emitted when the loading timeout is reached\n *\n * @slot - The content of the button. Can contain text, icons, or other elements.\n *\n * @csspart base - The main button container.\n * @csspart high-contrast - The high contrast part of the button.\n * @csspart content - The content wrapper inside the button.\n *\n * @cssproperty --dds-button-padding-x - Horizontal padding of the button (default: var(--dds-spacing-300))\n * @cssproperty --dds-button-padding-y - Vertical padding of the button (default: var(--dds-spacing-300))\n * @cssproperty --dds-button-border-radius - Border radius of the button (default: var(--dds-radius-rounded))\n * @cssproperty --dds-button-font-weight - Font weight of the button (default: 700)\n * @cssproperty --dds-button-line-height - Line height of the button (default: var(--dds-font-line-height-large))\n * @cssproperty --dds-button-transition - Transition property of the button (default: all 0.2s ease-in-out)\n * @cssproperty --dds-button-disabled-opacity - Opacity of disabled button (default: 0.5)\n *\n * @cssproperty --dds-button-size-lg - Size of large button (default: var(--dds-spacing-1200))\n * @cssproperty --dds-button-size-md - Size of medium button (default: var(--dds-spacing-1000))\n * @cssproperty --dds-button-size-sm - Size of small button (default: var(--dds-spacing-800))\n * @cssproperty --dds-button-size-xs - Size of extra small button (default: var(--dds-spacing-600))\n *\n * @cssproperty --dds-button-circle-lg - Size of large circle button (default: var(--dds-spacing-1200))\n * @cssproperty --dds-button-circle-md - Size of medium circle button (default: var(--dds-spacing-1000))\n * @cssproperty --dds-button-circle-sm - Size of small circle button (default: var(--dds-spacing-800))\n * @cssproperty --dds-button-circle-xs - Size of extra small circle button (default: var(--dds-spacing-600))\n *\n * Primary button properties:\n * @cssproperty --dds-button-primary-color-bg - Background color of primary button (default: var(--dds-button-primary-background-enabled))\n * @cssproperty --dds-button-primary-color-bg-hover - Background color of primary button on hover (default: var(--dds-button-primary-background-hover))\n * @cssproperty --dds-button-primary-color-bg-active - Background color of primary button when active (default: var(--dds-button-primary-background-pressed))\n * @cssproperty --dds-button-primary-color-bg-disabled - Background color of disabled primary button (default: var(--dds-button-primary-background-disabled))\n * @cssproperty --dds-button-primary-color-text - Text color of primary button (default: var(--dds-button-primary-text-enabled))\n * @cssproperty --dds-button-primary-color-text-disabled - Text color of disabled primary button (default: var(--dds-button-primary-text-disabled))\n *\n * Primary inverted button properties:\n * @cssproperty --dds-button-primary-inverted-color-bg - Background color of primary inverted button (default: var(--dds-button-primary-background-inverted-enabled))\n * @cssproperty --dds-button-primary-inverted-color-bg-hover - Background color of primary inverted button on hover (default: var(--dds-button-primary-background-inverted-hover))\n * @cssproperty --dds-button-primary-inverted-color-bg-active - Background color of primary inverted button when active (default: var(--dds-button-primary-background-inverted-pressed))\n * @cssproperty --dds-button-primary-inverted-color-bg-disabled - Background color of disabled primary inverted button (default: var(--dds-button-primary-background-inverted-disabled))\n * @cssproperty --dds-button-primary-inverted-color-text - Text color of primary inverted button (default: var(--dds-button-primary-text-inverted))\n * @cssproperty --dds-button-primary-inverted-color-text-disabled - Text color of disabled primary inverted button (default: var(--dds-button-primary-text-inverted-disabled))\n *\n * Outline button properties:\n * @cssproperty --dds-button-outline-color-border - Border color of outline button (default: var(--dds-button-outline-border-enabled))\n * @cssproperty --dds-button-outline-color-border-hover - Border color of outline button on hover (default: var(--dds-button-outline-border-hover))\n * @cssproperty --dds-button-outline-color-border-active - Border color of outline button when active (default: var(--dds-button-outline-border-pressed))\n * @cssproperty --dds-button-outline-color-border-disabled - Border color of disabled outline button (default: var(--dds-button-outline-border-disabled))\n * @cssproperty --dds-button-outline-color-text - Text color of outline button (default: var(--dds-button-outline-text-enabled))\n * @cssproperty --dds-button-outline-color-text-hover - Text color of outline button on hover (default: var(--dds-button-outline-text-hover))\n * @cssproperty --dds-button-outline-color-text-active - Text color of outline button when active (default: var(--dds-button-outline-text-pressed))\n * @cssproperty --dds-button-outline-color-text-disabled - Text color of disabled outline button (default: var(--dds-button-outline-text-disabled))\n *\n * Outline inverted button properties:\n * @cssproperty --dds-button-outline-inverted-color-border - Border color of outline inverted button (default: var(--dds-button-outline-border-inverted-enabled))\n * @cssproperty --dds-button-outline-inverted-color-border-hover - Border color of outline inverted button on hover (default: var(--dds-button-outline-border-inverted-hover))\n * @cssproperty --dds-button-outline-inverted-color-border-active - Border color of outline inverted button when active (default: var(--dds-button-outline-border-inverted-pressed))\n * @cssproperty --dds-button-outline-inverted-color-border-disabled - Border color of disabled outline inverted button (default: var(--dds-button-outline-border-inverted-disabled))\n * @cssproperty --dds-button-outline-inverted-color-text - Text color of outline inverted button (default: var(--dds-button-outline-text-inverted-enabled))\n * @cssproperty --dds-button-outline-inverted-color-text-hover - Text color of outline inverted button on hover (default: var(--dds-button-outline-text-inverted-hover))\n * @cssproperty --dds-button-outline-inverted-color-text-active - Text color of outline inverted button when active (default: var(--dds-button-outline-text-inverted-pressed))\n * @cssproperty --dds-button-outline-inverted-color-text-disabled - Text color of disabled outline inverted button (default: var(--dds-button-outline-text-inverted-disabled))\n *\n * Subtle button properties:\n * @cssproperty --dds-button-subtle-color-bg - Background color of subtle button (default: var(--dds-button-subtle-background-enabled))\n * @cssproperty --dds-button-subtle-color-bg-hover - Background color of subtle button on hover (default: var(--dds-button-subtle-background-hover))\n * @cssproperty --dds-button-subtle-color-bg-active - Background color of subtle button when active (default: var(--dds-button-subtle-background-pressed))\n * @cssproperty --dds-button-subtle-color-bg-disabled - Background color of disabled subtle button (default: var(--dds-button-subtle-background-disabled))\n * @cssproperty --dds-button-subtle-color-border - Border color of subtle button (default: var(--dds-button-subtle-border-enabled))\n * @cssproperty --dds-button-subtle-color-border-hover - Border color of subtle button on hover (default: var(--dds-button-subtle-border-hover))\n * @cssproperty --dds-button-subtle-color-border-active - Border color of subtle button when active (default: var(--dds-button-subtle-border-pressed))\n * @cssproperty --dds-button-subtle-color-border-disabled - Border color of disabled subtle button (default: var(--dds-button-subtle-border-disabled))\n * @cssproperty --dds-button-subtle-color-text - Text color of subtle button (default: var(--dds-button-subtle-text-enabled))\n * @cssproperty --dds-button-subtle-color-text-hover - Text color of subtle button on hover (default: var(--dds-button-subtle-text-hover))\n * @cssproperty --dds-button-subtle-color-text-active - Text color of subtle button when active (default: var(--dds-button-subtle-text-pressed))\n * @cssproperty --dds-button-subtle-color-text-disabled - Text color of disabled subtle button (default: var(--dds-button-subtle-text-disabled))\n *\n * Subtle neutral button properties:\n * @cssproperty --dds-button-subtle-neutral-color-bg - Background color of subtle neutral button (default: var(--dds-button-subtle-background-neutral-enabled))\n * @cssproperty --dds-button-subtle-neutral-color-bg-hover - Background color of subtle neutral button on hover (default: var(--dds-button-subtle-background-neutral-hover))\n * @cssproperty --dds-button-subtle-neutral-color-bg-active - Background color of subtle neutral button when active (default: var(--dds-button-subtle-background-neutral-pressed))\n * @cssproperty --dds-button-subtle-neutral-color-border - Border color of subtle neutral button (default: var(--dds-button-subtle-border-neutral-enabled))\n * @cssproperty --dds-button-subtle-neutral-color-border-hover - Border color of subtle neutral button on hover (default: var(--dds-button-subtle-border-neutral-hover))\n * @cssproperty --dds-button-subtle-neutral-color-border-active - Border color of subtle neutral button when active (default: var(--dds-button-subtle-border-neutral-pressed))\n * @cssproperty --dds-button-subtle-neutral-color-text - Text color of subtle neutral button (default: var(--dds-button-subtle-text-neutral-enabled))\n * @cssproperty --dds-button-subtle-neutral-color-text-hover - Text color of subtle neutral button on hover (default: var(--dds-button-subtle-text-neutral-hover))\n * @cssproperty --dds-button-subtle-neutral-color-text-active - Text color of subtle neutral button when active (default: var(--dds-button-subtle-text-neutral-hover))\n *\n * Subtle inverted button properties:\n * @cssproperty --dds-button-subtle-inverted-color-bg - Background color of subtle inverted button (default: var(--dds-button-subtle-background-inverted-enabled))\n * @cssproperty --dds-button-subtle-inverted-color-bg-hover - Background color of subtle inverted button on hover (default: var(--dds-button-subtle-background-inverted-hover))\n * @cssproperty --dds-button-subtle-inverted-color-bg-active - Background color of subtle inverted button when active (default: var(--dds-button-subtle-background-inverted-pressed))\n * @cssproperty --dds-button-subtle-inverted-color-border - Border color of subtle inverted button (default: var(--dds-button-subtle-border-inverted-enabled))\n * @cssproperty --dds-button-subtle-inverted-color-border-hover - Border color of subtle inverted button on hover (default: var(--dds-button-subtle-border-inverted-enabled))\n * @cssproperty --dds-button-subtle-inverted-color-border-active - Border color of subtle inverted button when active (default: var(--dds-button-subtle-border-inverted-enabled))\n * @cssproperty --dds-button-subtle-inverted-color-text - Text color of subtle inverted button (default: var(--dds-button-subtle-text-inverted))\n * @cssproperty --dds-button-subtle-inverted-color-text-hover - Text color of subtle inverted button on hover (default: var(--dds-button-subtle-text-inverted))\n * @cssproperty --dds-button-subtle-inverted-color-text-active - Text color of subtle inverted button when active (default: var(--dds-button-subtle-text-inverted))\n *\n * Subtle menu button properties:\n * @cssproperty --dds-button-subtle-menu-color-bg - Background color of subtle menu button (default: transparent)\n * @cssproperty --dds-button-subtle-menu-color-bg-hover - Background color of subtle menu button on hover (default: var(--dds-button-subtle-background-neutral-hover))\n * @cssproperty --dds-button-subtle-menu-color-bg-active - Background color of subtle menu button when active (default: var(--dds-button-subtle-background-neutral-pressed))\n * @cssproperty --dds-button-subtle-menu-color-border - Border color of subtle menu button (default: transparent)\n * @cssproperty --dds-button-subtle-menu-color-border-hover - Border color of subtle menu button on hover (default: transparent)\n * @cssproperty --dds-button-subtle-menu-color-border-active - Border color of subtle menu button when active (default: transparent)\n * @cssproperty --dds-button-subtle-menu-color-text - Text color of subtle menu button (default: var(--dds-button-subtle-text-neutral-enabled))\n * @cssproperty --dds-button-subtle-menu-color-text-hover - Text color of subtle menu button on hover (default: var(--dds-button-subtle-text-neutral-hover))\n * @cssproperty --dds-button-subtle-menu-color-text-active - Text color of subtle menu button when active (default: var(--dds-button-subtle-text-neutral-hover))\n * @cssproperty --dds-button-subtle-menu-border-radius - Border radius of subtle menu button (default: var(--dds-radius-small))\n * @cssproperty --dds-button-subtle-menu-opened-border-radius - Border radius of subtle menu button while the menu is open (default: var(--dds-radius-small))\n * @cssproperty --dds-button-subtle-menu-opened-border - Border color of subtle menu button while the menu is open (default: transparent)\n * @cssproperty --dds-button-subtle-menu-opened-background - Background color of subtle menu button while the menu is open (default: var(--dds-button-subtle-background-neutral-pressed))\n * @cssproperty --dds-button-subtle-menu-opened-color - Text color of subtle menu button while the menu is open (default: var(--dds-button-subtle-text-neutral-hover))\n *\n * Subtle menu item button properties:\n * @cssproperty --dds-button-subtle-menu-item-color-bg - Background color of subtle menu item button (default: transparent)\n * @cssproperty --dds-button-subtle-menu-item-color-bg-hover - Background color of subtle menu item button on hover (default: var(--dds-transparent-black-subtle))\n * @cssproperty --dds-button-subtle-menu-item-color-bg-active - Background color of subtle menu item button when active (default: var(--dds-transparent-black-subtle))\n * @cssproperty --dds-button-subtle-menu-item-color-text - Text color of subtle menu item button (default: var(--dds-text-primary-base))\n * @cssproperty --dds-button-subtle-menu-item-color-text-hover - Text color of subtle menu item button on hover (default: var(--dds-text-primary-base))\n * @cssproperty --dds-button-subtle-menu-item-color-text-active - Text color of subtle menu item button when active (default: var(--dds-text-primary-base))\n * @cssproperty --dds-button-subtle-menu-item-color-text-disabled - Text color of disabled subtle menu item button (default: var(--dds-text-primary-base))\n * @cssproperty --dds-button-subtle-menu-item-padding - Padding of subtle menu item button (default: var(--dds-spacing-100) var(--dds-spacing-200))\n * @cssproperty --dds-button-subtle-menu-item-border-radius - Border radius of subtle menu item button (default: var(--dds-radius-small))\n * @cssproperty --dds-button-subtle-menu-item-font-weight - Font weight of subtle menu item button (default: var(--dds-font-weight-medium))\n * @cssproperty --dds-button-subtle-menu-item-font-size - Font size of subtle menu item button (default: var(--dds-font-size-base))\n * @cssproperty --dds-button-subtle-menu-item-line-height - Line height of subtle menu item button (default: var(--dds-font-line-height-xlarge))\n *\n * Clean button properties:\n * @cssproperty --dds-button-clean-color-text - Text color of clean button (default: var(--dds-text-link-base))\n * @cssproperty --dds-button-clean-color-text-hover - Text color of clean button on hover (default: var(--dds-text-link-hover))\n * @cssproperty --dds-button-clean-color-text-active - Text color of clean button when active (default: var(--dds-text-link-pressed))\n * @cssproperty --dds-button-clean-color-text-disabled - Text color of disabled clean button (default: var(--dds-text-neutral-disabled))\n *\n * Clean inverted button properties:\n * @cssproperty --dds-button-clean-inverted-color-text - Text color of clean inverted button (default: var(--dds-button-primary-text-inverted))\n * @cssproperty --dds-button-clean-inverted-color-text-hover - Text color of clean inverted button on hover (default: var(--dds-button-primary-text-inverted))\n * @cssproperty --dds-button-clean-inverted-color-text-active - Text color of clean inverted button when active (default: var(--dds-button-primary-text-inverted))\n * @cssproperty --dds-button-clean-inverted-color-text-disabled - Text color of disabled clean inverted button (default: var(--dds-text-neutral-disabled))\n *\n * Danger button properties:\n * @cssproperty --dds-button-danger-color-bg - Background color of danger button (default: var(--dds-button-primary-background-destructive-enabled))\n * @cssproperty --dds-button-danger-color-bg-hover - Background color of danger button on hover (default: var(--dds-button-primary-background-destructive-hover))\n * @cssproperty --dds-button-danger-color-bg-active - Background color of danger button when active (default: var(--dds-button-primary-background-destructive-pressed))\n * @cssproperty --dds-button-danger-color-text - Text color of danger button (default: var(--dds-button-primary-text-enabled))\n * @cssproperty --dds-button-danger-outline-color-border - Border color of danger outline button (default: var(--dds-button-outline-border-destructive-enabled))\n * @cssproperty --dds-button-danger-outline-color-border-hover - Border color of danger outline button on hover (default: var(--dds-button-outline-border-destructive-hover))\n * @cssproperty --dds-button-danger-outline-color-border-active - Border color of danger outline button when active (default: var(--dds-button-outline-border-destructive-pressed))\n * @cssproperty --dds-button-danger-outline-color-text - Text color of danger outline button (default: var(--dds-button-outline-text-destructive-enabled))\n * @cssproperty --dds-button-danger-outline-color-text-hover - Text color of danger outline button on hover (default: var(--dds-button-outline-text-destructive-hover))\n * @cssproperty --dds-button-danger-outline-color-text-active - Text color of danger outline button when active (default: var(--dds-button-outline-text-destructive-pressed))\n * @cssproperty --dds-button-subtle-destructive-color-bg - Background color of danger subtle button (default: var(--dds-button-subtle-background-destructive-enabled))\n * @cssproperty --dds-button-subtle-destructive-color-bg-hover - Background color of danger subtle button on hover (default: var(--dds-button-subtle-background-destructive-hover))\n * @cssproperty --dds-button-subtle-destructive-color-bg-active - Background color of danger subtle button when active (default: var(--dds-button-subtle-background-destructive-pressed))\n * @cssproperty --dds-button-subtle-destructive-color-border - Border color of danger subtle button (default: var(--dds-button-subtle-border-destructive-enabled))\n * @cssproperty --dds-button-subtle-destructive-color-border-hover - Border color of danger subtle button on hover (default: var(--dds-button-subtle-border-destructive-hover))\n * @cssproperty --dds-button-subtle-destructive-color-border-active - Border color of danger subtle button when active (default: var(--dds-button-subtle-border-destructive-pressed))\n * @cssproperty --dds-button-subtle-destructive-color-text - Text color of danger subtle button (default: var(--dds-button-subtle-text-destructive-enabled))\n * @cssproperty --dds-button-subtle-destructive-color-text-hover - Text color of danger subtle button on hover (default: var(--dds-button-subtle-text-destructive-hover))\n * @cssproperty --dds-button-subtle-destructive-color-text-active - Text color of danger subtle button when active (default: var(--dds-button-subtle-text-destructive-pressed))\n * @cssproperty --dds-button-danger-clean-color-text - Text color of danger clean button (default: var(--dds-button-subtle-text-destructive-enabled))\n * @cssproperty --dds-button-danger-clean-color-text-hover - Text color of danger clean button on hover (default: var(--dds-button-subtle-text-destructive-hover))\n * @cssproperty --dds-button-danger-clean-color-text-active - Text color of danger clean button when active (default: var(--dds-button-subtle-text-destructive-pressed))\n */\nexport default class DapDSButton extends GenericFormElement {\n static override tagName = 'dap-ds-button'\n\n /** Components rendered inside the button, auto-registered on first use. */\n static override dependencies = {\n 'dap-ds-icon': DapDSIcon,\n 'dap-ds-icon-loading-spinner': SystemLoadingSpinner,\n }\n\n /**\n * @ignore\n */\n @query('.button') readonly button!: HTMLButtonElement | HTMLLinkElement\n\n /** The visual style variant of the button\n * @type { 'primary' | 'outline' | 'subtle' | 'subtle-neutral' | 'subtle-quiet' | 'subtle-quiet-inverted' | 'clean' | 'primary-inverted' | 'outline-inverted' | 'subtle-inverted' | 'clean-inverted' | 'subtle-menu' | 'subtle-menu-item' }\n * @default 'primary'\n * @example\n * ```html\n * <dap-ds-button variant=\"primary\">Primary action</dap-ds-button>\n * <dap-ds-button variant=\"outline\">Secondary action</dap-ds-button>\n * <dap-ds-button variant=\"subtle\">Tertiary action</dap-ds-button>\n * ```\n * @group Visual\n */\n @property({ reflect: true }) variant: ButtonVariant = 'primary'\n\n /** The size of the button affecting padding and font size\n * @type { 'lg' | 'md' | 'sm' | 'xs' }\n * @default 'md'\n * @example\n * ```html\n * <dap-ds-button size=\"xs\">Extra small</dap-ds-button>\n * <dap-ds-button size=\"sm\">Small</dap-ds-button>\n * <dap-ds-button>Medium (default)</dap-ds-button>\n * <dap-ds-button size=\"lg\">Large</dap-ds-button>\n * ```\n * @group Visual\n */\n @property({ reflect: true }) size: ButtonSize = 'md'\n\n /** Whether the button is in loading state, showing a spinner and disabling interaction\n * @default false\n * @example\n * ```html\n * <dap-ds-button loading>Submitting...</dap-ds-button>\n * ```\n * @group State\n */\n @property({ type: Boolean, reflect: true }) loading = false\n\n /** Whether the button represents a destructive action (applies danger styling)\n * @default false\n * @example\n * ```html\n * <dap-ds-button danger>Delete Account</dap-ds-button>\n * <dap-ds-button variant=\"outline\" danger>Remove Item</dap-ds-button>\n * ```\n * @group State\n */\n @property({ type: Boolean }) danger = false\n\n /** The shape of the button - use 'circle' for icon-only buttons\n * @type { 'button' | 'circle' }\n * @default 'button'\n * @example\n * ```html\n * <dap-ds-button shape=\"circle\" aria-label=\"Close\">\n * <dap-ds-icon name=\"close-line\"></dap-ds-icon>\n * </dap-ds-button>\n * ```\n * @group Visual\n */\n @property({ reflect: true }) shape: ButtonShape = 'button'\n\n /** The HTML type attribute for form interaction\n * @type { 'button' | 'submit' | 'reset' }\n * @default 'button'\n * @example\n * ```html\n * <form>\n * <dap-ds-button htmlType=\"submit\">Submit</dap-ds-button>\n * <dap-ds-button htmlType=\"reset\">Reset</dap-ds-button>\n * </form>\n * ```\n * @group Form\n */\n @property() htmlType: HtmlButtonType = 'button'\n\n /** The URL to navigate to. When present, the button renders as an anchor element\n * @example\n * ```html\n * <dap-ds-button href=\"/dashboard\">Go to Dashboard</dap-ds-button>\n * <dap-ds-button href=\"https://example.com\" target=\"_blank\">External Link</dap-ds-button>\n * ```\n * @group Navigation\n */\n @property() href?: string\n\n /** The target attribute for link navigation\n * @type { '_blank' | '_self' | '_parent' | '_top' }\n * @default '_self'\n * @example\n * ```html\n * <dap-ds-button href=\"https://example.com\" target=\"_blank\">Open in new tab</dap-ds-button>\n * ```\n * @group Navigation\n */\n @property() target: LinkTarget = '_self'\n\n /** The rel attribute for link security and behavior\n * @default 'noreferrer noopener'\n * @example\n * ```html\n * <dap-ds-button href=\"https://example.com\" rel=\"noopener\">Safe external link</dap-ds-button>\n * ```\n * @group Navigation\n */\n @property() rel?: string\n\n /** Controls loading timeout in milliseconds\n * @default 0\n * @group State\n */\n @property({ type: Number }) loadingTimeout = 0\n\n /** Enables high contrast theme toggle functionality (internal use)\n * @default false\n * @ignore\n */\n @property({ type: Boolean }) hc: boolean = false\n\n /** Whether the button is active\n * @default false\n * @example\n * ```html\n * <dap-ds-button active>Active</dap-ds-button>\n * ```\n */\n @property({ type: Boolean }) active: boolean = false\n\n /**\n * Enable OKLCH proof-of-concept theming (experimental)\n * @default false\n * @internal\n * @ignore\n */\n @property({ type: Boolean, attribute: 'data-oklch-poc', reflect: true })\n oklchPoc: boolean = false\n\n /** The text for the target blank link, applicable when target is _blank. PRO TIP: Use parenthesis to wrap the text */\n @property({ type: String }) targetBlankText: string\n\n /** Overrides the ARIA role on the internal native button/anchor element. Use when the host's semantics must differ from the native element (e.g. role=\"link\" on a button acting as a SPA navigation trigger). */\n @property({ type: String }) forceRole?: string\n\n static readonly styles = unsafeCSS(styles)\n\n private loadingTimer?: number\n\n /** Persisted aria-label for the inner button; host attribute is removed so we keep the value here */\n private _ariaLabelForButton: string | null = null\n\n /** Internal flag to ignore the aria-label change triggered by our own attribute cleanup */\n private _ignoreNextAriaLabelChange = false\n\n private getSecureRel(): string {\n if (this.target === '_blank') {\n return this.rel ?? 'noreferrer noopener'\n }\n return this.rel ?? ''\n }\n\n private validateAriaPressed(): string | undefined | null {\n if (\n this.ariaPressed &&\n !['true', 'false', 'mixed'].includes(this.ariaPressed)\n ) {\n console.warn('aria-pressed must be \"true\", \"false\", or \"mixed\"')\n return undefined\n }\n\n return this.ariaPressed\n }\n\n private getAriaExpanded(): string | null | undefined {\n if (this.ariaExpanded && !['true', 'false'].includes(this.ariaExpanded)) {\n console.warn('aria-expanded must be \"true\" or \"false\"')\n return undefined\n }\n return this.ariaExpanded\n }\n\n private validateProperties(): void {\n if (\n this.shape === 'circle' &&\n !this.effectiveAriaLabel &&\n !this.textContent?.trim() &&\n !this.ariaHidden\n ) {\n console.warn(\n 'Circle buttons require aria-label or visible text for accessibility',\n )\n }\n\n if (this.href && this.htmlType !== 'button') {\n console.warn(\n 'htmlType is ignored when href is provided - button will render as anchor',\n )\n }\n\n if (this.href && !this.isValidUrl(this.href)) {\n console.warn('Invalid URL provided for href attribute')\n }\n }\n\n private isValidUrl(url: string): boolean {\n try {\n if (\n url.startsWith('/') ||\n url.startsWith('./') ||\n url.startsWith('../')\n ) {\n return true\n }\n new URL(url)\n return true\n } catch {\n return false\n }\n }\n\n private handleClick(event: Event): boolean {\n if (this.disabled || this.loading) {\n // Returning false does not cancel a Lit listener, and an anchor has no\n // native disabled state, so without this a disabled href button navigates.\n event.preventDefault()\n event.stopPropagation()\n return false\n }\n\n let handled = false\n if (this.htmlType !== 'button') {\n const proxy = document.createElement('button')\n proxy.type = this.htmlType\n this.insertAdjacentElement('afterend', proxy)\n\n proxy.click()\n proxy.remove()\n handled = true\n }\n\n if (this.hc) {\n this.toggleHighContrast()\n }\n\n return handled\n }\n\n private handleKeyDown(event: KeyboardEvent): void {\n // Only handle keyboard events for anchor elements that act as buttons\n if (!this.href) {\n return\n }\n\n // WAI-ARIA: Elements acting as buttons must respond to Enter and Space keys\n if (event.key === ' ' || event.key === 'Enter') {\n if (this.disabled || this.loading) {\n event.preventDefault()\n event.stopPropagation()\n return\n }\n\n // For Space key: prevent default scrolling behavior and trigger click\n if (event.key === ' ') {\n event.preventDefault()\n event.stopPropagation()\n this.button.click()\n }\n }\n }\n\n private toggleHighContrast(): void {\n document.body.classList.toggle('high-contrast-theme')\n }\n\n private startLoadingTimeout(): void {\n if (this.loadingTimeout > 0) {\n this.loadingTimer = window.setTimeout(() => {\n this.loading = false\n this.emit(\n 'dds-loading-timeout',\n {\n timeout: this.loadingTimeout,\n },\n {\n bubbles: true,\n },\n )\n }, this.loadingTimeout)\n }\n }\n\n private clearLoadingTimeout(): void {\n if (this.loadingTimer) {\n clearTimeout(this.loadingTimer)\n this.loadingTimer = undefined\n }\n }\n\n /**\n * `this.button` is a `@query`, so it is null until Lit has rendered the shadow root.\n * A caller focusing a button the same tick it mounts -- a \"Save\" button that appears\n * only after the form it belongs to opens, say -- would otherwise get a TypeError,\n * not a no-op. Throwing out of a focus() call breaks whatever effect made it.\n */\n focus(options?: FocusOptions) {\n this.button?.focus(options)\n }\n\n blur() {\n this.button?.blur()\n }\n\n /**\n * @ignore\n */\n public get focusElement() {\n return this.button\n }\n\n /** Aria-label for the inner button; survives host attribute removal so Lit does not clear it */\n private get effectiveAriaLabel(): string | null {\n return this.ariaLabel ?? this._ariaLabelForButton\n }\n\n protected updated(\n changedProperties: Map<string | number | symbol, unknown>,\n ): void {\n super.updated(changedProperties)\n\n if (changedProperties.has('ariaLabel')) {\n const newValue = this.ariaLabel\n\n if (newValue != null && newValue !== '') {\n // Persist value before removing host attribute so the inner button keeps it\n this._ariaLabelForButton = newValue\n } else if (!this._ignoreNextAriaLabelChange) {\n // Only clear when the consumer explicitly removes/clears aria-label\n this._ariaLabelForButton = null\n }\n\n // Reset the guard after handling the change\n this._ignoreNextAriaLabelChange = false\n }\n\n if (this.ariaLabel != null && this.ariaLabel !== '') {\n // Removing the host attribute will trigger another ariaLabel change,\n // which we intentionally ignore so the inner button keeps its label.\n this._ignoreNextAriaLabelChange = true\n this.removeAttribute('aria-label')\n }\n\n if (changedProperties.has('loading')) {\n if (this.loading) {\n this.startLoadingTimeout()\n } else {\n this.clearLoadingTimeout()\n }\n }\n }\n\n protected firstUpdated(\n _changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>,\n ): void {\n super.firstUpdated(_changedProperties)\n this.validateProperties()\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback()\n this.clearLoadingTimeout()\n }\n\n render() {\n return html`\n <${unsafeStatic(this.href ? 'a' : 'button')}\n part=\"base\"\n .disabled=${this.disabled}\n aria-disabled=${this.disabled}\n aria-hidden=${ifDefined(this.ariaHidden)}\n aria-expanded=${ifDefined(this.getAriaExpanded())}\n aria-controls=${ifDefined(this.ariaControls)}\n aria-label=${ifDefined(this.effectiveAriaLabel)}\n aria-haspopup=${ifDefined(this.ariaHasPopup)}\n aria-describedby=${ifDefined(this.ariaDescribedBy)}\n aria-pressed=${ifDefined(this.validateAriaPressed())}\n role=${ifDefined(this.forceRole)}\n .autofocus=${this.autofocus}\n tabindex=${ifDefined(this.href && this.disabled ? '-1' : undefined)}\n type=${ifDefined(this.href ? null : this.htmlType)}\n name=${ifDefined(this.name)}\n href=${ifDefined(this.href)}\n target=${ifDefined(this.target)}\n rel=${ifDefined(this.getSecureRel())}\n class=${clsx(\n buttonVariants({\n intent: this.variant,\n size: this.effectiveSize as ButtonSize,\n shape: this.shape,\n }),\n {\n 'dds-button--danger': this.danger,\n 'dds-button--loading': this.loading,\n 'dds-button--active': this.active,\n // An anchor never reflects a disabled attribute, so the [disabled]\n // styling cannot reach it. Style off the class, as link--disabled does.\n 'button--disabled': this.disabled,\n },\n )}\n @click=${this.handleClick}\n @keydown=${this.handleKeyDown}>\n <div part=\"high-contrast\" class=\"button__highcontrast\"></div>\n ${\n this.loading\n ? this._getLoadingSpinner()\n : html` <span part=\"content\" class=\"button__text\">\n <slot></slot>\n </span>`\n }\n ${\n this.target === '_blank'\n ? html`<span class=\"sr-only\">\n ${this.targetBlankText ?? t('opensInNewTab')}</span\n >`\n : nothing\n }\n </${unsafeStatic(this.href ? 'a' : 'button')}>\n `\n }\n\n private getLoadingIconSize(size: ButtonSize): number {\n return LOADING_ICON_SIZES[size] || LOADING_ICON_SIZES.md\n }\n\n private _getLoadingSpinner() {\n return html`\n <span class=\"button__spinner\" aria-live=\"polite\">\n <dap-ds-icon-loading-spinner\n size=${this.getLoadingIconSize(this.effectiveSize as ButtonSize)}\n aria-label=${t('loading')}></dap-ds-icon-loading-spinner>\n </span>\n `\n }\n}\n"],"names":["LOADING_ICON_SIZES","_DapDSButton","GenericFormElement","_a","_b","url","e","event","handled","proxy","options","changedProperties","newValue","_changedProperties","html","unsafeStatic","ifDefined","clsx","buttonVariants","t","nothing","size","DapDSIcon","SystemLoadingSpinner","unsafeCSS","styles","DapDSButton","__decorateClass","query","property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3BE,EAAS,EAAE,MAAM,OAAQ,CAAA;AAAA,GA5HPH,EA4HS,WAAA,gBAAA;AAMCC,EAAA;AAAA,EAA5BE,EAAS,EAAE,MAAM,QAAS,CAAA;AAAA,GAlIRH,EAkIU,WAAA,IAAA;AASAC,EAAA;AAAA,EAA5BE,EAAS,EAAE,MAAM,QAAS,CAAA;AAAA,GA3IRH,EA2IU,WAAA,QAAA;AAS7BC,EAAA;AAAA,EADCE,EAAS,EAAE,MAAM,SAAS,WAAW,kBAAkB,SAAS,GAAM,CAAA;AAAA,GAnJpDH,EAoJnB,WAAA,UAAA;AAG4BC,EAAA;AAAA,EAA3BE,EAAS,EAAE,MAAM,OAAQ,CAAA;AAAA,GAvJPH,EAuJS,WAAA,iBAAA;AAGAC,EAAA;AAAA,EAA3BE,EAAS,EAAE,MAAM,OAAQ,CAAA;AAAA,GA1JPH,EA0JS,WAAA,WAAA;"}
|
|
@@ -41,7 +41,7 @@ import { default as DapDSTypography } from '../typography/typography.component';
|
|
|
41
41
|
* @event {{ value: string }} dds-change - Fired when the datepicker value changes.
|
|
42
42
|
* @event {{ value: string }} dds-input - Fired when the datepicker input value changes.
|
|
43
43
|
* @event {{ value: string }} dds-valid-date - Fired when the datepicker input value is valid. Happens on manual input typing.
|
|
44
|
-
* @event {{ value: string, type: 'invalid' | 'out-of-range' }} dds-invalid-date - Fired when the datepicker input value is invalid. Happens on manual input typing.
|
|
44
|
+
* @event {{ value: string, type: 'invalid' | 'out-of-range', date?: string }} dds-invalid-date - Fired when the datepicker input value is invalid. Happens on manual input typing. For `out-of-range` the typed text was a well-formed date, so `date` carries it as an ISO (`YYYY-MM-DD`) string and the consumer can phrase its own range message; for `invalid` the text could not be parsed and `date` is omitted.
|
|
45
45
|
* @event {{ void }} dds-clear - Fired when the datepicker is cleared.
|
|
46
46
|
* @event {{ void }} dds-focus - Emitted when the datepicker gains focus.
|
|
47
47
|
* @event {{ void }} dds-blur - Emitted when the datepicker loses focus.
|
|
@@ -132,12 +132,12 @@ export default class DapDSDatePicker extends GenericFormElement {
|
|
|
132
132
|
* @default dayjs()
|
|
133
133
|
*/
|
|
134
134
|
currentDate?: Dayjs | string | Date;
|
|
135
|
-
/** The
|
|
135
|
+
/** The earliest date the datepicker accepts. Compared with day granularity.
|
|
136
136
|
* @type {Dayjs | string | Date}
|
|
137
137
|
* @default dayjs('1901-01-01')
|
|
138
138
|
*/
|
|
139
139
|
minDate?: Dayjs | string | Date;
|
|
140
|
-
/** The
|
|
140
|
+
/** The latest date the datepicker accepts. Compared with day granularity.
|
|
141
141
|
* @type {Dayjs | string | Date}
|
|
142
142
|
* @default dayjs('2099-12-31')
|
|
143
143
|
*/
|
|
@@ -2,14 +2,14 @@ var f = (g, t, i) => new Promise((e, s) => {
|
|
|
2
2
|
var a = (m) => {
|
|
3
3
|
try {
|
|
4
4
|
y(i.next(m));
|
|
5
|
-
} catch (
|
|
6
|
-
s(
|
|
5
|
+
} catch (b) {
|
|
6
|
+
s(b);
|
|
7
7
|
}
|
|
8
8
|
}, n = (m) => {
|
|
9
9
|
try {
|
|
10
10
|
y(i.throw(m));
|
|
11
|
-
} catch (
|
|
12
|
-
s(
|
|
11
|
+
} catch (b) {
|
|
12
|
+
s(b);
|
|
13
13
|
}
|
|
14
14
|
}, y = (m) => m.done ? e(m.value) : Promise.resolve(m.value).then(a, n);
|
|
15
15
|
y((i = i.apply(g, t)).next());
|
|
@@ -17,35 +17,37 @@ var f = (g, t, i) => new Promise((e, s) => {
|
|
|
17
17
|
import { clsx as c } from "../../node_modules/clsx/dist/clsx.js";
|
|
18
18
|
import l from "../../_virtual/dayjs.min.js";
|
|
19
19
|
import "../../node_modules/@lit/reactive-element/reactive-element.js";
|
|
20
|
-
import { nothing as
|
|
20
|
+
import { nothing as D } from "../../node_modules/lit-html/lit-html.js";
|
|
21
21
|
import "../../node_modules/lit-element/lit-element.js";
|
|
22
22
|
import { property as d } from "../../node_modules/@lit/reactive-element/decorators/property.js";
|
|
23
|
-
import { state as
|
|
24
|
-
import { query as
|
|
23
|
+
import { state as S } from "../../node_modules/@lit/reactive-element/decorators/state.js";
|
|
24
|
+
import { query as V } from "../../node_modules/@lit/reactive-element/decorators/query.js";
|
|
25
25
|
import { ifDefined as p } from "../../node_modules/lit-html/directives/if-defined.js";
|
|
26
26
|
import { html as u } from "../../node_modules/lit-html/static.js";
|
|
27
|
-
import { getValidityStateObject as
|
|
28
|
-
import { GenericFormElement as
|
|
27
|
+
import { getValidityStateObject as I } from "../../common/utils.js";
|
|
28
|
+
import { GenericFormElement as k } from "../../internal/mixin/genericFormElement.js";
|
|
29
29
|
import "../../localization/localization.js";
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
import
|
|
41
|
-
import { t as
|
|
42
|
-
import { unsafeCSS as
|
|
43
|
-
var
|
|
30
|
+
import C from "../calendar/calendar.component.js";
|
|
31
|
+
import z from "../feedback/feedback.component.js";
|
|
32
|
+
import E from "../form/form-label/form-label.component.js";
|
|
33
|
+
import M from "../icon/icon.component.js";
|
|
34
|
+
import F from "../icon-button/icon-button.component.js";
|
|
35
|
+
import x from "../icons/business/business-calendar-line/business-calendar-line.component.js";
|
|
36
|
+
import A from "../icons/system/system-loading-spinner/system-loading-spinner.component.js";
|
|
37
|
+
import w from "../popup/popup.component.js";
|
|
38
|
+
import B from "../tooltip/tooltip.component.js";
|
|
39
|
+
import O from "../typography/typography.component.js";
|
|
40
|
+
import L from "./datepicker.scss.js";
|
|
41
|
+
import { t as T } from "../../node_modules/i18next/dist/esm/i18next.js";
|
|
42
|
+
import { unsafeCSS as q } from "../../node_modules/@lit/reactive-element/css-tag.js";
|
|
43
|
+
var U = Object.defineProperty, o = (g, t, i, e) => {
|
|
44
44
|
for (var s = void 0, a = g.length - 1, n; a >= 0; a--)
|
|
45
45
|
(n = g[a]) && (s = n(t, i, s) || s);
|
|
46
|
-
return s &&
|
|
47
|
-
}
|
|
48
|
-
const
|
|
46
|
+
return s && U(t, i, s), s;
|
|
47
|
+
};
|
|
48
|
+
const $ = "1901-01-01", v = "2099-12-31", Y = "YYYY-MM-DD";
|
|
49
|
+
var h;
|
|
50
|
+
const r = (h = class extends k {
|
|
49
51
|
constructor() {
|
|
50
52
|
super(), this.mode = "single", this.disabledDate = (i) => !i, this.placement = "bottom-start", this.opened = !1, this.openCalendarOnInput = !1, this.sendEmptyEventOnInput = !1, this.loading = !1, this.mask = !1, this.formatSeparator = "|", this.clearButton = "true", this.clearButtonTestId = "datepicker-clear-button", this.calendarButtonTestId = "datepicker-calendar-button", this.floatingStrategy = "fixed", this.disableViewportAutoClose = !1, this.locale = l.locale(), this.formatOptions = [], this.setValueState = !0, this.lastMaskDigitCount = 0, this.handleDocumentMouseDown = (i) => {
|
|
51
53
|
const e = i.composedPath();
|
|
@@ -63,10 +65,11 @@ const r = (h = class extends S {
|
|
|
63
65
|
if (!e.value)
|
|
64
66
|
this.setValue(void 0, !1, !0);
|
|
65
67
|
else if (this.isInputValid()) {
|
|
66
|
-
const s = l(e.value).locale(this.locale), a = this.normalizeDate(this.minDate) || l(
|
|
68
|
+
const s = l(e.value).locale(this.locale), a = this.normalizeDate(this.minDate) || l($), n = this.normalizeDate(this.maxDate) || l(v);
|
|
67
69
|
s.isBefore(a, "day") || s.isAfter(n, "day") ? (this.setValue(void 0, !1, this.sendEmptyEventOnInput), this.emit("dds-invalid-date", {
|
|
68
70
|
value: e.value,
|
|
69
|
-
type: "out-of-range"
|
|
71
|
+
type: "out-of-range",
|
|
72
|
+
date: s.format(Y)
|
|
70
73
|
})) : (this.setValue(s, !1), this.currentDate = s, this.emit("dds-valid-date", { value: e.value }));
|
|
71
74
|
} else
|
|
72
75
|
this.setValue(void 0, !1, this.sendEmptyEventOnInput), this.emit("dds-invalid-date", { value: e.value, type: "invalid" });
|
|
@@ -131,9 +134,9 @@ const r = (h = class extends S {
|
|
|
131
134
|
const i = this.normalizeDate(this.currentDate);
|
|
132
135
|
this.calendar.currentDate = i || l();
|
|
133
136
|
const e = this.normalizeDate(this.minDate);
|
|
134
|
-
this.calendar.minDate = e || l(
|
|
137
|
+
this.calendar.minDate = e || l($), e && (this.minDate = e);
|
|
135
138
|
const s = this.normalizeDate(this.maxDate);
|
|
136
|
-
this.calendar.maxDate = s || l(
|
|
139
|
+
this.calendar.maxDate = s || l(v), s && (this.maxDate = s), this.calendar.disabledDate = this.disabledDate, this.hideAdjacentMonths !== void 0 && (this.calendar.hideAdjacentMonths = this.hideAdjacentMonths);
|
|
137
140
|
}
|
|
138
141
|
updated(t) {
|
|
139
142
|
var s;
|
|
@@ -162,11 +165,11 @@ const r = (h = class extends S {
|
|
|
162
165
|
}
|
|
163
166
|
if (t.has("minDate")) {
|
|
164
167
|
const a = this.normalizeDate(this.minDate);
|
|
165
|
-
this.calendar.minDate = a || l(
|
|
168
|
+
this.calendar.minDate = a || l($), a && (this.minDate = a);
|
|
166
169
|
}
|
|
167
170
|
if (t.has("maxDate")) {
|
|
168
171
|
const a = this.normalizeDate(this.maxDate);
|
|
169
|
-
this.calendar.maxDate = a || l(
|
|
172
|
+
this.calendar.maxDate = a || l(v), a && (this.maxDate = a);
|
|
170
173
|
}
|
|
171
174
|
t.has("disabledDate") && (this.calendar.disabledDate = this.disabledDate), (t.has("format") || t.has("formatSeparator")) && (this.formatOptions = ((s = this.format) == null ? void 0 : s.split(this.formatSeparator)) || []);
|
|
172
175
|
}
|
|
@@ -255,7 +258,7 @@ const r = (h = class extends S {
|
|
|
255
258
|
return !!this.value;
|
|
256
259
|
}
|
|
257
260
|
get validity() {
|
|
258
|
-
return this.internals.validity ? this.internals.validity :
|
|
261
|
+
return this.internals.validity ? this.internals.validity : I({
|
|
259
262
|
valueMissing: this.required && !this.getValidity(),
|
|
260
263
|
patternMismatch: !this.isValueValid()
|
|
261
264
|
});
|
|
@@ -361,10 +364,10 @@ const r = (h = class extends S {
|
|
|
361
364
|
value=${this.getFormattedValue()}
|
|
362
365
|
aria-expanded=${this.opened}
|
|
363
366
|
aria-haspopup="dialog"
|
|
364
|
-
aria-labelledby=${p(this.label ? this.labelId :
|
|
367
|
+
aria-labelledby=${p(this.label ? this.labelId : D)}
|
|
365
368
|
aria-describedby="${p(
|
|
366
|
-
this.description ? this.descriptionId :
|
|
367
|
-
)} ${p(this.feedback ? this.feedbackId :
|
|
369
|
+
this.description ? this.descriptionId : D
|
|
370
|
+
)} ${p(this.feedback ? this.feedbackId : D)}"
|
|
368
371
|
aria-disabled=${this.disabled}
|
|
369
372
|
aria-controls="calendar"
|
|
370
373
|
aria-autocomplete="none"
|
|
@@ -392,11 +395,11 @@ const r = (h = class extends S {
|
|
|
392
395
|
part="clear-button"
|
|
393
396
|
data-testid=${this.clearButtonTestId}
|
|
394
397
|
aria-label=${p(
|
|
395
|
-
(i = this.clearButtonAriaLabel) != null ? i :
|
|
398
|
+
(i = this.clearButtonAriaLabel) != null ? i : T("clear", { lng: this.locale })
|
|
396
399
|
)}
|
|
397
400
|
?disabled=${this.disabled}
|
|
398
401
|
@click=${this.handleClearClick}></dap-ds-icon-button>
|
|
399
|
-
</div>` :
|
|
402
|
+
</div>` : D}
|
|
400
403
|
<div
|
|
401
404
|
class="${c("indicator-icon", {
|
|
402
405
|
"indicator-icon--loading": this.loading
|
|
@@ -437,16 +440,16 @@ const r = (h = class extends S {
|
|
|
437
440
|
</div>`;
|
|
438
441
|
}
|
|
439
442
|
}, h.tagName = "dap-ds-datepicker", h.dependencies = {
|
|
440
|
-
"dap-ds-form-label":
|
|
441
|
-
"dap-ds-tooltip":
|
|
442
|
-
"dap-ds-icon-button":
|
|
443
|
-
"dap-ds-icon":
|
|
444
|
-
"dap-ds-typography":
|
|
445
|
-
"dap-ds-popup":
|
|
446
|
-
"dap-ds-icon-loading-spinner":
|
|
447
|
-
"dap-ds-icon-calendar-line":
|
|
448
|
-
"dap-ds-calendar":
|
|
449
|
-
"dap-ds-feedback":
|
|
443
|
+
"dap-ds-form-label": E,
|
|
444
|
+
"dap-ds-tooltip": B,
|
|
445
|
+
"dap-ds-icon-button": F,
|
|
446
|
+
"dap-ds-icon": M,
|
|
447
|
+
"dap-ds-typography": O,
|
|
448
|
+
"dap-ds-popup": w,
|
|
449
|
+
"dap-ds-icon-loading-spinner": A,
|
|
450
|
+
"dap-ds-icon-calendar-line": x,
|
|
451
|
+
"dap-ds-calendar": C,
|
|
452
|
+
"dap-ds-feedback": z
|
|
450
453
|
}, h.nextId = 0, h.datePropertyConverter = {
|
|
451
454
|
fromAttribute: (t) => {
|
|
452
455
|
if (t == null || t === "")
|
|
@@ -464,15 +467,15 @@ const r = (h = class extends S {
|
|
|
464
467
|
}
|
|
465
468
|
},
|
|
466
469
|
toAttribute: (t) => t == null ? null : l.isDayjs(t) || t instanceof Date ? t.toISOString() : typeof t == "string" ? t : typeof t == "number" ? String(t) : null
|
|
467
|
-
}, h.styles = L
|
|
470
|
+
}, h.styles = q(L), h);
|
|
468
471
|
o([
|
|
469
|
-
|
|
472
|
+
V(".combobox__input")
|
|
470
473
|
], r.prototype, "triggerInput");
|
|
471
474
|
o([
|
|
472
|
-
|
|
475
|
+
V("#calendar")
|
|
473
476
|
], r.prototype, "calendar");
|
|
474
477
|
o([
|
|
475
|
-
|
|
478
|
+
V("dap-ds-popup")
|
|
476
479
|
], r.prototype, "popup");
|
|
477
480
|
o([
|
|
478
481
|
d({
|
|
@@ -562,13 +565,13 @@ o([
|
|
|
562
565
|
d({ type: Boolean })
|
|
563
566
|
], r.prototype, "hideAdjacentMonths");
|
|
564
567
|
o([
|
|
565
|
-
|
|
568
|
+
S()
|
|
566
569
|
], r.prototype, "formatOptions");
|
|
567
570
|
o([
|
|
568
|
-
|
|
571
|
+
S()
|
|
569
572
|
], r.prototype, "setValueState");
|
|
570
|
-
let
|
|
573
|
+
let mt = r;
|
|
571
574
|
export {
|
|
572
|
-
|
|
575
|
+
mt as default
|
|
573
576
|
};
|
|
574
577
|
//# sourceMappingURL=datepicker.component.js.map
|