@beeq/core 1.10.0-beta.4 → 1.10.0-beta.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.
Files changed (99) hide show
  1. package/dist/beeq/beeq.esm.js +1 -1
  2. package/dist/beeq/bq-breadcrumb-item.entry.esm.js.map +1 -1
  3. package/dist/beeq/bq-button.bq-icon.entry.esm.js.map +1 -1
  4. package/dist/beeq/bq-date-picker.entry.esm.js.map +1 -1
  5. package/dist/beeq/bq-option-list.bq-tag.entry.esm.js.map +1 -1
  6. package/dist/beeq/bq-tooltip.entry.esm.js.map +1 -1
  7. package/dist/beeq/{p-74daa290.entry.js → p-126b0e1a.entry.js} +2 -2
  8. package/dist/beeq/p-126b0e1a.entry.js.map +1 -0
  9. package/dist/beeq/p-2e94c104.entry.js +6 -0
  10. package/dist/beeq/{p-9573c018.entry.js.map → p-2e94c104.entry.js.map} +1 -1
  11. package/dist/beeq/{p-c110a7ea.entry.js → p-428af3e5.entry.js} +2 -2
  12. package/dist/beeq/{p-01d832d0.entry.js → p-4998c911.entry.js} +2 -2
  13. package/dist/beeq/{p-01d832d0.entry.js.map → p-4998c911.entry.js.map} +1 -1
  14. package/dist/beeq/p-8a5e5138.entry.js +6 -0
  15. package/dist/beeq/p-8a5e5138.entry.js.map +1 -0
  16. package/dist/beeq/{p-1cd5bf89.entry.js → p-b99ea02f.entry.js} +2 -2
  17. package/dist/beeq/p-b99ea02f.entry.js.map +1 -0
  18. package/dist/beeq/{p-ad869f7e.entry.js → p-dbe8b775.entry.js} +2 -2
  19. package/dist/beeq.html-custom-data.json +427 -427
  20. package/dist/cjs/bq-breadcrumb-item.cjs.entry.js +1 -1
  21. package/dist/cjs/bq-breadcrumb-item.cjs.entry.js.map +1 -1
  22. package/dist/cjs/bq-breadcrumb-item.entry.cjs.js.map +1 -1
  23. package/dist/cjs/bq-button.bq-icon.entry.cjs.js.map +1 -1
  24. package/dist/cjs/bq-button_2.cjs.entry.js +5 -5
  25. package/dist/cjs/bq-button_2.cjs.entry.js.map +1 -1
  26. package/dist/cjs/bq-date-picker.cjs.entry.js +54 -41
  27. package/dist/cjs/bq-date-picker.cjs.entry.js.map +1 -1
  28. package/dist/cjs/bq-date-picker.entry.cjs.js.map +1 -1
  29. package/dist/cjs/bq-option-list.bq-tag.entry.cjs.js.map +1 -1
  30. package/dist/cjs/bq-option-list_2.cjs.entry.js +2 -2
  31. package/dist/cjs/bq-option-list_2.cjs.entry.js.map +1 -1
  32. package/dist/cjs/bq-select.cjs.entry.js +1 -1
  33. package/dist/cjs/bq-side-menu-item.cjs.entry.js +1 -1
  34. package/dist/cjs/bq-tooltip.cjs.entry.js +32 -2
  35. package/dist/cjs/bq-tooltip.cjs.entry.js.map +1 -1
  36. package/dist/cjs/bq-tooltip.entry.cjs.js.map +1 -1
  37. package/dist/collection/components/button/bq-button.js +8 -8
  38. package/dist/collection/components/button/bq-button.js.map +1 -1
  39. package/dist/collection/components/date-picker/bq-date-picker.js +53 -40
  40. package/dist/collection/components/date-picker/bq-date-picker.js.map +1 -1
  41. package/dist/collection/components/date-picker/scss/bq-date-picker.css +1 -1
  42. package/dist/collection/components/select/scss/bq-select.css +1 -1
  43. package/dist/collection/components/tooltip/bq-tooltip.js +129 -1
  44. package/dist/collection/components/tooltip/bq-tooltip.js.map +1 -1
  45. package/dist/components/bq-alert.js +1 -1
  46. package/dist/components/bq-breadcrumb-item.js +1 -1
  47. package/dist/components/bq-breadcrumb-item.js.map +1 -1
  48. package/dist/components/bq-button.js +1 -1
  49. package/dist/components/bq-date-picker.js +1 -1
  50. package/dist/components/bq-date-picker.js.map +1 -1
  51. package/dist/components/bq-dialog.js +1 -1
  52. package/dist/components/bq-drawer.js +1 -1
  53. package/dist/components/bq-input.js +1 -1
  54. package/dist/components/bq-notification.js +1 -1
  55. package/dist/components/bq-progress.js +1 -1
  56. package/dist/components/bq-select.js +1 -1
  57. package/dist/components/bq-side-menu-item.js +1 -1
  58. package/dist/components/bq-slider.js +1 -1
  59. package/dist/components/bq-steps.js +1 -1
  60. package/dist/components/bq-steps.js.map +1 -1
  61. package/dist/components/bq-tag.js +1 -1
  62. package/dist/components/bq-tooltip.js +1 -1
  63. package/dist/components/{p-BUpGMEPS.js → p-3kuGtVv3.js} +2 -2
  64. package/dist/components/p-BQic-e0B.js +6 -0
  65. package/dist/components/p-BQic-e0B.js.map +1 -0
  66. package/dist/components/{p-BmdGoExW.js → p-YV07eeSP.js} +2 -2
  67. package/dist/components/{p-BmdGoExW.js.map → p-YV07eeSP.js.map} +1 -1
  68. package/dist/custom-elements.json +6404 -6345
  69. package/dist/esm/bq-breadcrumb-item.entry.js +1 -1
  70. package/dist/esm/bq-breadcrumb-item.entry.js.map +1 -1
  71. package/dist/esm/bq-button.bq-icon.entry.js.map +1 -1
  72. package/dist/esm/bq-button_2.entry.js +5 -5
  73. package/dist/esm/bq-button_2.entry.js.map +1 -1
  74. package/dist/esm/bq-date-picker.entry.js +54 -41
  75. package/dist/esm/bq-date-picker.entry.js.map +1 -1
  76. package/dist/esm/bq-option-list.bq-tag.entry.js.map +1 -1
  77. package/dist/esm/bq-option-list_2.entry.js +2 -2
  78. package/dist/esm/bq-option-list_2.entry.js.map +1 -1
  79. package/dist/esm/bq-select.entry.js +1 -1
  80. package/dist/esm/bq-side-menu-item.entry.js +1 -1
  81. package/dist/esm/bq-tooltip.entry.js +33 -3
  82. package/dist/esm/bq-tooltip.entry.js.map +1 -1
  83. package/dist/hydrate/index.js +91 -48
  84. package/dist/hydrate/index.mjs +91 -48
  85. package/dist/types/components/button/bq-button.d.ts +3 -3
  86. package/dist/types/components/date-picker/bq-date-picker.d.ts +4 -2
  87. package/dist/types/components/tooltip/bq-tooltip.d.ts +11 -0
  88. package/dist/types/components.d.ts +42 -3
  89. package/package.json +1 -1
  90. package/dist/beeq/p-1cd5bf89.entry.js.map +0 -1
  91. package/dist/beeq/p-5b5442ce.entry.js +0 -6
  92. package/dist/beeq/p-5b5442ce.entry.js.map +0 -1
  93. package/dist/beeq/p-74daa290.entry.js.map +0 -1
  94. package/dist/beeq/p-9573c018.entry.js +0 -6
  95. package/dist/components/p-C63H4SKY.js +0 -6
  96. package/dist/components/p-C63H4SKY.js.map +0 -1
  97. /package/dist/beeq/{p-c110a7ea.entry.js.map → p-428af3e5.entry.js.map} +0 -0
  98. /package/dist/beeq/{p-ad869f7e.entry.js.map → p-dbe8b775.entry.js.map} +0 -0
  99. /package/dist/components/{p-BUpGMEPS.js.map → p-3kuGtVv3.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"bq-tooltip.entry.cjs.js","sources":["../../packages/beeq/src/components/tooltip/scss/bq-tooltip.scss?tag=bq-tooltip&encapsulation=shadow","../../packages/beeq/src/components/tooltip/bq-tooltip.tsx"],"sourcesContent":["/* -------------------------------------------------------------------------- */\n/* Tooltip styles */\n/* -------------------------------------------------------------------------- */\n\n@import './bq-tooltip.variables';\n\n.bq-tooltip--panel {\n @include animation-fade-in;\n @apply pointer-events-none fixed z-[--bq-tooltip--z-index] box-border bg-[--bq-tooltip--background-color];\n @apply is-[--bq-tooltip--width] max-is-[--bq-tooltip--max-width] p-b-[--bq-tooltip--paddingY] p-i-[--bq-tooltip--paddingX];\n @apply text-[length:--bq-tooltip--font-size] leading-[--bq-tooltip--line-height] text-[color:--bq-tooltip--text-color];\n @apply rounded-[--bq-tooltip--border-radius] border-[length:--bq-tooltip--border-width] border-[color:--bq-tooltip--border-color];\n @apply shadow-[shadow:--bq-tooltip--box-shadow];\n}\n\n.bq-tooltip--arrow {\n &,\n &::before {\n @apply absolute -z-[1] bs-2 is-2;\n }\n\n &::before {\n @apply start-0 rotate-45 bg-[--bq-tooltip--background-color] content-empty inset-bs-0;\n }\n}\n","import { Component, Element, h, Listen, Method, Prop, Watch } from '@stencil/core';\n\nimport type { Placement } from '../../services/interfaces';\nimport { FloatingUI } from '../../services/libraries';\nimport { isEventTargetChildOfElement } from '../../shared/utils';\n\n/**\n * The Tooltip component is a small pop-up box that appears when a user hovers over or clicks on an element, providing additional information or context.\n *\n * @example How to use it\n * ```html\n * <bq-tooltip visible>\n * Yuhu! I'm a tooltip 🙃\n * <bq-button slot=\"trigger\">Hover me!</bq-button>\n * </bq-tooltip>\n * ```\n *\n * @documentation https://www.beeq.design/3d466e231/p/64c562-tooltip\n * @status stable\n *\n * @attr {boolean} always-visible - If true, the tooltip will always be visible\n * @attr {number} distance - Distance between trigger element and tooltip\n * @attr {boolean} hide-arrow - If true, the arrow on the tooltip content won't be shown\n * @attr {\"top\" | \"right\" | \"bottom\" | \"left\"} placement - Defines the position of the tooltip\n * @attr {boolean} same-width - Whether the tooltip should have the same width as the trigger element (applicable only for content shorter than the trigger element)\n * @attr {\"click\" | \"hover\"} display-on - Set the action when the tooltip should be displayed, on hover (default) or click\n * @attr {boolean} visible - Indicates whether or not the tooltip is visible when the component is first rendered, and when interacting with the trigger\n *\n * @method show - Shows the tooltip\n * @method hide - Hides the tooltip\n *\n * @slot trigger - The element which displays tooltip on hover\n * @slot - The tooltip content\n *\n * @part base - The component wrapper container inside the shadow DOM\n * @part trigger - The `<div>` container that holds the element which displays tooltip on hover\n * @part panel - The `<div>` container that holds the tooltip content\n *\n * @cssprop --bq-tooltip--background-color - Tooltip background color\n * @cssprop --bq-tooltip--box-shadow - Tooltip box shadow\n * @cssprop --bq-tooltip--font-size - Tooltip font size\n * @cssprop --bq-tooltip--line-height - Tooltip line height\n * @cssprop --bq-tooltip--text-color - Tooltip text color\n * @cssprop --bq-tooltip--paddingX - Tooltip horizontal padding\n * @cssprop --bq-tooltip--paddingY - Tooltip vertical padding\n * @cssprop --bq-tooltip--border-color - Tooltip border color\n * @cssprop --bq-tooltip--border-radius - Tooltip border radius\n * @cssprop --bq-tooltip--border-style - Tooltip border style\n * @cssprop --bq-tooltip--border-width - Tooltip border width\n * @cssprop --bq-tooltip--z-index: Tooltip z-index\n */\n@Component({\n tag: 'bq-tooltip',\n styleUrl: './scss/bq-tooltip.scss',\n shadow: true,\n})\nexport class BqTooltip {\n // Own Properties\n // ====================\n private trigger: HTMLElement;\n private panel: HTMLElement;\n private arrow: HTMLElement;\n private floatingUI: FloatingUI;\n\n // Reference to host HTML element\n // ===================================\n @Element() el!: HTMLBqTooltipElement;\n\n // State() variables\n // Inlined decorator, alphabetical order\n // =======================================\n\n // Public Property API\n // ========================\n\n /** If true, the tooltip will always be visible */\n @Prop() alwaysVisible?: boolean = false;\n\n /** Distance between trigger element and tooltip */\n @Prop({ reflect: true }) distance?: number = 10;\n\n /** If true, the arrow on the tooltip content won't be shown */\n @Prop({ reflect: true }) hideArrow?: boolean = false;\n\n /* Defines the position of the tooltip */\n @Prop({ reflect: true }) placement?: Placement = 'top';\n\n /** Whether the tooltip should have the same width as the trigger element\n * (applicable only for content shorter than the trigger element) */\n @Prop({ reflect: true }) sameWidth?: boolean = false;\n\n /** Set the action when the tooltip should be displayed, on hover (default) or click */\n @Prop({ reflect: true }) displayOn: 'click' | 'hover' = 'hover';\n\n /**\n * Indicates whether or not the tooltip is visible when the component is first rendered,\n * and when interacting with the trigger\n */\n @Prop({ reflect: true, mutable: true }) visible? = false;\n\n // Prop lifecycle events\n // =======================\n\n @Watch('visible')\n async handleVisibleChange() {\n if (!this.visible && !this.alwaysVisible) {\n return await this.hide();\n }\n\n await this.show();\n }\n\n @Watch('distance')\n @Watch('hideArrow')\n @Watch('placement')\n @Watch('sameWidth')\n handleFloatingUIOptionsChange() {\n this.floatingUI.init({\n placement: this.placement,\n distance: this.distance,\n sameWidth: this.sameWidth,\n strategy: 'fixed',\n });\n }\n // Events section\n // Requires JSDocs for public API documentation\n // ==============================================\n\n // Component lifecycle events\n // Ordered by their natural call order\n // =====================================\n\n componentDidLoad() {\n this.floatingUI = new FloatingUI(this.trigger, this.panel, {\n ...(!this.hideArrow && { arrow: this.arrow }),\n placement: this.placement,\n distance: this.distance,\n sameWidth: this.sameWidth,\n strategy: 'fixed',\n skidding: 0,\n });\n }\n\n disconnectedCallback() {\n this.floatingUI?.destroy();\n }\n // Listeners\n // ==============\n\n @Listen('keydown', { target: 'document' })\n handleDocumentKeyDown(event: KeyboardEvent) {\n // Early returns for performance optimization\n if (this.alwaysVisible || !this.visible || this.displayOn !== 'click') return;\n // Hide tooltip when the user presses the escape key, but only if the displayOn is click and the tooltip is visible\n if (event.key !== 'Escape') return;\n\n this.hide();\n }\n\n @Listen('mousedown', { target: 'document' })\n handleDocumentMouseDown(event: MouseEvent) {\n // Early returns for performance optimization\n if (this.alwaysVisible || !this.visible) return;\n // Hide tooltip when the user clicks outside of the tooltip, but only if the displayOn is click and the tooltip is visible\n if (isEventTargetChildOfElement(event, this.el)) return;\n\n this.hide();\n }\n\n @Listen('scroll', { target: 'document', passive: true })\n handleDocumentScroll() {\n // Early returns for performance optimization\n if (this.alwaysVisible || !this.visible) return;\n // Hide tooltip when the user scrolls, but only if the the tooltip is visible\n this.hide();\n }\n\n // Public methods API\n // These methods are exposed on the host element.\n // Always use two lines.\n // Public Methods must be async.\n // Requires JSDocs for public API documentation.\n // ===============================================\n\n /** Shows the tooltip */\n @Method()\n async show() {\n this.visible = true;\n this.showTooltip();\n }\n\n /** Hides the tooltip */\n @Method()\n async hide() {\n if (this.alwaysVisible) return;\n\n this.visible = false;\n this.hideTooltip();\n }\n\n // Local methods\n // Internal business logic.\n // These methods cannot be called from the host element.\n // =======================================================\n\n private handleTriggerMouseOver = async () => {\n if (this.displayOn !== 'hover') return;\n await this.show();\n };\n\n private handleTriggerMouseLeave = async () => {\n if (this.displayOn !== 'hover') return;\n await this.hide();\n };\n\n private handleTriggerOnClick = async () => {\n if (this.displayOn !== 'click') return;\n await (this.visible ? this.hide() : this.show());\n };\n\n private handleTriggerFocusin = async () => {\n if (this.visible || this.displayOn === 'click') return;\n await this.show();\n };\n\n private handleTriggerFocusout = async () => {\n if (!this.visible || this.displayOn === 'click') return;\n await this.hide();\n };\n\n private showTooltip = () => {\n if (!this.panel) return;\n this.floatingUI?.update();\n };\n\n private hideTooltip = () => {\n if (!this.panel) return;\n this.visible = false;\n };\n\n private get isHidden() {\n return !this.visible && !this.alwaysVisible;\n }\n\n // render() function\n // Always the last one in the class.\n // ===================================\n\n render() {\n return (\n <div class=\"bq-tooltip relative\" part=\"base\">\n {/* TRIGGER */}\n <div\n class=\"bq-tooltip--trigger\"\n onMouseOver={this.handleTriggerMouseOver}\n onMouseLeave={this.handleTriggerMouseLeave}\n onClick={this.handleTriggerOnClick}\n onFocusinCapture={this.handleTriggerFocusin}\n onFocusoutCapture={this.handleTriggerFocusout}\n ref={(el) => (this.trigger = el)}\n part=\"trigger\"\n >\n <slot name=\"trigger\" />\n </div>\n {/* PANEL */}\n <div\n class=\"bq-tooltip--panel\"\n aria-hidden={this.isHidden}\n hidden={this.isHidden}\n role=\"tooltip\"\n ref={(el) => (this.panel = el)}\n part=\"panel\"\n >\n {!this.hideArrow && <div class=\"bq-tooltip--arrow\" ref={(el) => (this.arrow = el)} />}\n <slot />\n </div>\n </div>\n );\n }\n}\n"],"names":["FloatingUI","event","isEventTargetChildOfElement","h"],"mappings":";;;;;;;;;;AAAA,MAAM,YAAY,GAAG,k1tBAAk1tB;;MCwD11tB,SAAS,GAAA,MAAA;;;;;;AAGZ,IAAA,OAAO;AACP,IAAA,KAAK;AACL,IAAA,KAAK;AACL,IAAA,UAAU;;;;;;;;IAcV,aAAa,GAAa,KAAK;;IAGd,QAAQ,GAAY,EAAE;;IAGtB,SAAS,GAAa,KAAK;;IAG3B,SAAS,GAAe,KAAK;AAEtD;AACoE;IAC3C,SAAS,GAAa,KAAK;;IAG3B,SAAS,GAAsB,OAAO;AAE/D;;;AAGG;IACqC,OAAO,GAAI,KAAK;;;AAMxD,IAAA,MAAM,mBAAmB,GAAA;QACvB,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;AACxC,YAAA,OAAO,MAAM,IAAI,CAAC,IAAI,EAAE;;AAG1B,QAAA,MAAM,IAAI,CAAC,IAAI,EAAE;;IAOnB,6BAA6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AA,EACrFA,OAAQ,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,CAAA,CACJ,CACF;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"bq-tooltip.entry.cjs.js","sources":["../../packages/beeq/src/components/tooltip/scss/bq-tooltip.scss?tag=bq-tooltip&encapsulation=shadow","../../packages/beeq/src/components/tooltip/bq-tooltip.tsx"],"sourcesContent":["/* -------------------------------------------------------------------------- */\n/* Tooltip styles */\n/* -------------------------------------------------------------------------- */\n\n@import './bq-tooltip.variables';\n\n.bq-tooltip--panel {\n @include animation-fade-in;\n @apply pointer-events-none fixed z-[--bq-tooltip--z-index] box-border bg-[--bq-tooltip--background-color];\n @apply is-[--bq-tooltip--width] max-is-[--bq-tooltip--max-width] p-b-[--bq-tooltip--paddingY] p-i-[--bq-tooltip--paddingX];\n @apply text-[length:--bq-tooltip--font-size] leading-[--bq-tooltip--line-height] text-[color:--bq-tooltip--text-color];\n @apply rounded-[--bq-tooltip--border-radius] border-[length:--bq-tooltip--border-width] border-[color:--bq-tooltip--border-color];\n @apply shadow-[shadow:--bq-tooltip--box-shadow];\n}\n\n.bq-tooltip--arrow {\n &,\n &::before {\n @apply absolute -z-[1] bs-2 is-2;\n }\n\n &::before {\n @apply start-0 rotate-45 bg-[--bq-tooltip--background-color] content-empty inset-bs-0;\n }\n}\n","import { Component, Element, Event, h, Listen, Method, Prop, Watch } from '@stencil/core';\nimport type { EventEmitter } from '@stencil/core';\n\nimport type { Placement } from '../../services/interfaces';\nimport { FloatingUI } from '../../services/libraries';\nimport { isEventTargetChildOfElement } from '../../shared/utils';\n\n/**\n * The Tooltip component is a small pop-up box that appears when a user hovers over or clicks on an element, providing additional information or context.\n *\n * @example How to use it\n * ```html\n * <bq-tooltip visible>\n * Yuhu! I'm a tooltip 🙃\n * <bq-button slot=\"trigger\">Hover me!</bq-button>\n * </bq-tooltip>\n * ```\n *\n * @documentation https://www.beeq.design/3d466e231/p/64c562-tooltip\n * @status stable\n *\n * @attr {boolean} always-visible - If true, the tooltip will always be visible\n * @attr {number} distance - Distance between trigger element and tooltip\n * @attr {boolean} hide-arrow - If true, the arrow on the tooltip content won't be shown\n * @attr {\"top\" | \"right\" | \"bottom\" | \"left\"} placement - Defines the position of the tooltip\n * @attr {boolean} same-width - Whether the tooltip should have the same width as the trigger element (applicable only for content shorter than the trigger element)\n * @attr {\"click\" | \"hover\"} display-on - Set the action when the tooltip should be displayed, on hover (default) or click\n * @attr {boolean} visible - Indicates whether or not the tooltip is visible when the component is first rendered, and when interacting with the trigger\n *\n * @method show - Shows the tooltip\n * @method hide - Hides the tooltip\n *\n * @slot trigger - The element which displays tooltip on hover\n * @slot - The tooltip content\n *\n * @part base - The component wrapper container inside the shadow DOM\n * @part trigger - The `<div>` container that holds the element which displays tooltip on hover\n * @part panel - The `<div>` container that holds the tooltip content\n *\n * @cssprop --bq-tooltip--background-color - Tooltip background color\n * @cssprop --bq-tooltip--box-shadow - Tooltip box shadow\n * @cssprop --bq-tooltip--font-size - Tooltip font size\n * @cssprop --bq-tooltip--line-height - Tooltip line height\n * @cssprop --bq-tooltip--text-color - Tooltip text color\n * @cssprop --bq-tooltip--paddingX - Tooltip horizontal padding\n * @cssprop --bq-tooltip--paddingY - Tooltip vertical padding\n * @cssprop --bq-tooltip--border-color - Tooltip border color\n * @cssprop --bq-tooltip--border-radius - Tooltip border radius\n * @cssprop --bq-tooltip--border-style - Tooltip border style\n * @cssprop --bq-tooltip--border-width - Tooltip border width\n * @cssprop --bq-tooltip--z-index: Tooltip z-index\n */\n@Component({\n tag: 'bq-tooltip',\n styleUrl: './scss/bq-tooltip.scss',\n shadow: true,\n})\nexport class BqTooltip {\n // Own Properties\n // ====================\n private trigger: HTMLElement;\n private panel: HTMLElement;\n private arrow: HTMLElement;\n private floatingUI: FloatingUI;\n\n // Reference to host HTML element\n // ===================================\n @Element() el!: HTMLBqTooltipElement;\n\n // State() variables\n // Inlined decorator, alphabetical order\n // =======================================\n\n // Public Property API\n // ========================\n\n /** If true, the tooltip will always be visible */\n @Prop() alwaysVisible?: boolean = false;\n\n /** Distance between trigger element and tooltip */\n @Prop({ reflect: true }) distance?: number = 10;\n\n /** If true, the arrow on the tooltip content won't be shown */\n @Prop({ reflect: true }) hideArrow?: boolean = false;\n\n /* Defines the position of the tooltip */\n @Prop({ reflect: true }) placement?: Placement = 'top';\n\n /** Whether the tooltip should have the same width as the trigger element\n * (applicable only for content shorter than the trigger element) */\n @Prop({ reflect: true }) sameWidth?: boolean = false;\n\n /** Set the action when the tooltip should be displayed, on hover (default) or click */\n @Prop({ reflect: true }) displayOn: 'click' | 'hover' = 'hover';\n\n /**\n * Indicates whether or not the tooltip is visible when the component is first rendered,\n * and when interacting with the trigger\n */\n @Prop({ reflect: true, mutable: true }) visible? = false;\n\n // Prop lifecycle events\n // =======================\n\n @Watch('visible')\n async handleVisibleChange() {\n if (!this.visible && !this.alwaysVisible) {\n return await this.hide();\n }\n\n await this.show();\n }\n\n @Watch('distance')\n @Watch('hideArrow')\n @Watch('placement')\n @Watch('sameWidth')\n handleFloatingUIOptionsChange() {\n this.floatingUI.init({\n placement: this.placement,\n distance: this.distance,\n sameWidth: this.sameWidth,\n strategy: 'fixed',\n });\n }\n\n // Events section\n // Requires JSDocs for public API documentation\n // ==============================================\n\n /** Emitted when the tooltip trigger is clicked */\n @Event() bqClick: EventEmitter<HTMLBqTooltipElement>;\n\n /** Emitted when the tooltip trigger is focused in */\n @Event() bqFocusIn: EventEmitter<HTMLBqTooltipElement>;\n\n /** Emitted when the tooltip trigger is focused out */\n @Event() bqFocusOut: EventEmitter<HTMLBqTooltipElement>;\n\n /** Emitted when the tooltip trigger is hovered in */\n @Event() bqHoverIn: EventEmitter<HTMLBqTooltipElement>;\n\n /** Emitted when the tooltip trigger is hovered out */\n @Event() bqHoverOut: EventEmitter<HTMLBqTooltipElement>;\n\n // Component lifecycle events\n // Ordered by their natural call order\n // =====================================\n\n componentDidLoad() {\n this.floatingUI = new FloatingUI(this.trigger, this.panel, {\n ...(!this.hideArrow && { arrow: this.arrow }),\n placement: this.placement,\n distance: this.distance,\n sameWidth: this.sameWidth,\n strategy: 'fixed',\n skidding: 0,\n });\n }\n\n disconnectedCallback() {\n this.floatingUI?.destroy();\n }\n // Listeners\n // ==============\n\n @Listen('keydown', { target: 'document' })\n handleDocumentKeyDown(event: KeyboardEvent) {\n // Early returns for performance optimization\n if (this.alwaysVisible || !this.visible || this.displayOn !== 'click') return;\n // Hide tooltip when the user presses the escape key, but only if the displayOn is click and the tooltip is visible\n if (event.key !== 'Escape') return;\n\n this.hide();\n }\n\n @Listen('mousedown', { target: 'document' })\n handleDocumentMouseDown(event: MouseEvent) {\n // Early returns for performance optimization\n if (this.alwaysVisible || !this.visible) return;\n // Hide tooltip when the user clicks outside of the tooltip, but only if the displayOn is click and the tooltip is visible\n if (isEventTargetChildOfElement(event, this.el)) return;\n\n this.hide();\n }\n\n @Listen('scroll', { target: 'document', passive: true })\n handleDocumentScroll() {\n // Early returns for performance optimization\n if (this.alwaysVisible || !this.visible) return;\n // Hide tooltip when the user scrolls, but only if the the tooltip is visible\n this.hide();\n }\n\n // Public methods API\n // These methods are exposed on the host element.\n // Always use two lines.\n // Public Methods must be async.\n // Requires JSDocs for public API documentation.\n // ===============================================\n\n /** Shows the tooltip */\n @Method()\n async show() {\n this.visible = true;\n this.showTooltip();\n }\n\n /** Hides the tooltip */\n @Method()\n async hide() {\n if (this.alwaysVisible) return;\n\n this.visible = false;\n this.hideTooltip();\n }\n\n // Local methods\n // Internal business logic.\n // These methods cannot be called from the host element.\n // =======================================================\n\n private handleTriggerMouseOver = async () => {\n if (this.displayOn !== 'hover') return;\n\n const hoverEvent = this.bqHoverIn.emit(this.el);\n if (hoverEvent.defaultPrevented) return;\n\n await this.show();\n };\n\n private handleTriggerMouseLeave = async () => {\n if (this.displayOn !== 'hover') return;\n\n const hoverEvent = this.bqHoverOut.emit(this.el);\n if (hoverEvent.defaultPrevented) return;\n\n await this.hide();\n };\n\n private handleTriggerOnClick = async () => {\n if (this.displayOn !== 'click') return;\n\n const clickEvent = this.bqClick.emit(this.el);\n if (clickEvent.defaultPrevented) return;\n\n await (this.visible ? this.hide() : this.show());\n };\n\n private handleTriggerFocusin = async () => {\n if (this.visible || this.displayOn === 'click') return;\n\n const focusEvent = this.bqFocusIn.emit(this.el);\n if (focusEvent.defaultPrevented) return;\n\n await this.show();\n };\n\n private handleTriggerFocusout = async () => {\n if (!this.visible || this.displayOn === 'click') return;\n\n const focusEvent = this.bqFocusOut.emit(this.el);\n if (focusEvent.defaultPrevented) return;\n\n await this.hide();\n };\n\n private showTooltip = () => {\n if (!this.panel) return;\n this.floatingUI?.update();\n };\n\n private hideTooltip = () => {\n if (!this.panel) return;\n this.visible = false;\n };\n\n private get isHidden() {\n return !this.visible && !this.alwaysVisible;\n }\n\n // render() function\n // Always the last one in the class.\n // ===================================\n\n render() {\n return (\n <div class=\"bq-tooltip relative\" part=\"base\">\n {/* TRIGGER */}\n <div\n class=\"bq-tooltip--trigger\"\n onMouseOver={this.handleTriggerMouseOver}\n onMouseLeave={this.handleTriggerMouseLeave}\n onClick={this.handleTriggerOnClick}\n onFocusinCapture={this.handleTriggerFocusin}\n onFocusoutCapture={this.handleTriggerFocusout}\n ref={(el) => (this.trigger = el)}\n part=\"trigger\"\n >\n <slot name=\"trigger\" />\n </div>\n {/* PANEL */}\n <div\n class=\"bq-tooltip--panel\"\n aria-hidden={this.isHidden}\n hidden={this.isHidden}\n role=\"tooltip\"\n ref={(el) => (this.panel = el)}\n part=\"panel\"\n >\n {!this.hideArrow && <div class=\"bq-tooltip--arrow\" ref={(el) => (this.arrow = el)} />}\n <slot />\n </div>\n </div>\n );\n }\n}\n"],"names":["FloatingUI","event","isEventTargetChildOfElement","h"],"mappings":";;;;;;;;;;AAAA,MAAM,YAAY,GAAG,6itBAA6itB;;MCyDrjtB,SAAS,GAAA,MAAA;;;;;;;;;;;AAGZ,IAAA,OAAO;AACP,IAAA,KAAK;AACL,IA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,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,CAAA,CACJ,CACF;;;;;;;;;;;;;;"}
@@ -121,11 +121,11 @@ export class BqButton {
121
121
  // Events section
122
122
  // Requires JSDocs for public API documentation
123
123
  // ==============================================
124
- /** Handler to be called when the button loses focus */
124
+ /** Handler to be called when the button loses focus. */
125
125
  bqBlur;
126
- /** Handler to be called when the button is clicked */
126
+ /** Handler to be called when the button gets focus. */
127
127
  bqFocus;
128
- /** Handler to be called when button gets focus */
128
+ /** Handler to be called when the button is clicked. */
129
129
  bqClick;
130
130
  // Component lifecycle events
131
131
  // Ordered by their natural call order
@@ -207,7 +207,7 @@ export class BqButton {
207
207
  const style = {
208
208
  ...(this.border && { '--bq-button--border-radius': `var(--bq-radius--${this.border})` }),
209
209
  };
210
- return (h(Host, { key: '410e95f0e026439c9120d8f922f6f4bf2d04f8be', style: style }, h(TagElem, { key: '4a9859696c69f28fd36cf78c2ab2cac01fad220c', class: {
210
+ return (h(Host, { key: 'c2883c38f7ba77f302e3380899ac5f7c06f90b91', style: style }, h(TagElem, { key: '8d68505fd371f5299529dd341260bbe6179f2e3e', class: {
211
211
  'bq-button': true,
212
212
  [`bq-button--${this.appearance}`]: true,
213
213
  [`content-${this.justifyContent}`]: true,
@@ -218,7 +218,7 @@ export class BqButton {
218
218
  'has-prefix': this.hasPrefix,
219
219
  'has-suffix': this.hasSuffix,
220
220
  loading: this.loading,
221
- }, "aria-disabled": this.disabled ? 'true' : 'false', disabled: this.disabled, download: isLink ? this.download : undefined, href: isLink ? this.href : undefined, part: "button", rel: isLink && this.target ? 'noreferrer noopener' : undefined, target: isLink ? this.target : undefined, type: this.type, tabIndex: this.disabled ? -1 : 0, onBlur: this.handleBlur, onFocus: this.handleFocus, onClick: this.handleClick }, h("span", { key: 'b91e3ad88207204b61fd3f281ac6cfafcb97aca0', class: "bq-button__prefix", ref: (spanElem) => (this.prefixElem = spanElem), part: "prefix" }, h("slot", { key: 'b1ae2697421bc34845140a513afb674ae27b1835', name: "prefix", onSlotchange: this.handleSlotChange })), h("span", { key: '30489cc30befaa56b4cf86366879f7bf806346a8', class: "bq-button__label", part: "label" }, h("slot", { key: '78a0ce935be6e970f1f20a79bdb216d3bcb8180e' })), h("span", { key: 'e33f29677b185b0924bbe0b132d807990aa6e993', class: "bq-button__suffix", ref: (spanElem) => (this.suffixElem = spanElem), part: "suffix" }, h("slot", { key: 'fcbdc435471c93fc5e2d62ebb12d998ece7bf882', name: "suffix", onSlotchange: this.handleSlotChange })), this.loading && h("bq-icon", { key: '96cf28c5e5286e5e379670a7172b4732d4458191', class: "bq-button__loader", name: "spinner-gap" }))));
221
+ }, "aria-disabled": this.disabled ? 'true' : 'false', disabled: this.disabled, download: isLink ? this.download : undefined, href: isLink ? this.href : undefined, part: "button", rel: isLink && this.target ? 'noreferrer noopener' : undefined, target: isLink ? this.target : undefined, type: this.type, tabIndex: this.disabled ? -1 : 0, onBlur: this.handleBlur, onFocus: this.handleFocus, onClick: this.handleClick }, h("span", { key: '886e9327670a088ba995ed293c3a575f619d5d6b', class: "bq-button__prefix", ref: (spanElem) => (this.prefixElem = spanElem), part: "prefix" }, h("slot", { key: '6409e80258ba395d1a2e20938c481a2582598922', name: "prefix", onSlotchange: this.handleSlotChange })), h("span", { key: 'ca1103484e6f592856222c15fec6f5caa3a5f596', class: "bq-button__label", part: "label" }, h("slot", { key: '274442d0fb511eb65f9fa201af386cbc837222e1' })), h("span", { key: 'd8b1feb6937ec09ad6b46547189a86153aebde5c', class: "bq-button__suffix", ref: (spanElem) => (this.suffixElem = spanElem), part: "suffix" }, h("slot", { key: '1dd0212f81f247936120880062e110e36acecb01', name: "suffix", onSlotchange: this.handleSlotChange })), this.loading && h("bq-icon", { key: '1cf22b47ef26f567b918343c7878bad19b94e473', class: "bq-button__loader", name: "spinner-gap" }))));
222
222
  }
223
223
  static get is() { return "bq-button"; }
224
224
  static get encapsulation() { return "shadow"; }
@@ -520,7 +520,7 @@ export class BqButton {
520
520
  "composed": true,
521
521
  "docs": {
522
522
  "tags": [],
523
- "text": "Handler to be called when the button loses focus"
523
+ "text": "Handler to be called when the button loses focus."
524
524
  },
525
525
  "complexType": {
526
526
  "original": "HTMLBqButtonElement",
@@ -540,7 +540,7 @@ export class BqButton {
540
540
  "composed": true,
541
541
  "docs": {
542
542
  "tags": [],
543
- "text": "Handler to be called when the button is clicked"
543
+ "text": "Handler to be called when the button gets focus."
544
544
  },
545
545
  "complexType": {
546
546
  "original": "HTMLBqButtonElement",
@@ -560,7 +560,7 @@ export class BqButton {
560
560
  "composed": true,
561
561
  "docs": {
562
562
  "tags": [],
563
- "text": "Handler to be called when button gets focus"
563
+ "text": "Handler to be called when the button is clicked."
564
564
  },
565
565
  "complexType": {
566
566
  "original": "HTMLBqButtonElement",
@@ -1 +1 @@
1
- {"version":3,"file":"bq-button.js","sourceRoot":"","sources":["../../../../../../packages/beeq/src/components/button/bq-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAGxG,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAQhG,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEnG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AASH,MAAM,OAAO,QAAQ;IACnB,iBAAiB;IACjB,uBAAuB;IAEf,UAAU,CAAc;IACxB,UAAU,CAAc;IAEhC,iCAAiC;IACjC,sCAAsC;IAE3B,EAAE,CAAuB;IACjB,SAAS,CAAoB;IAEhD,oBAAoB;IACpB,wCAAwC;IACxC,0CAA0C;IAEzB,SAAS,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { AttachInternals, Component, Element, Event, h, Host, Prop, State, Watch } from '@stencil/core';\nimport type { EventEmitter } from '@stencil/core';\n\nimport { BUTTON_APPEARANCE, BUTTON_SIZE, BUTTON_TYPE, BUTTON_VARIANT } from './bq-button.types';\nimport type {\n TButtonAppearance,\n TButtonBorderRadius,\n TButtonSize,\n TButtonType,\n TButtonVariant,\n} from './bq-button.types';\nimport { hasSlotContent, isClient, isDefined, isNil, validatePropValue } from '../../shared/utils';\n\n/**\n * Buttons are designed for users to take action on a page or a screen.\n *\n * @example How to use it\n * ```html\n * <bq-button appearance=\"primary\" border=\"m\" size=\"medium\">\n * <bq-icon name=\"arrow-circle-left\" slot=\"prefix\"></bq-icon>\n * Go back\n * </bq-button>\n * ```\n *\n * @documentation https://www.beeq.design/3d466e231/p/286b43-buttons\n * @status stable\n *\n * @dependency bq-icon\n *\n * @attr {\"primary\" | \"secondary\" | \"link\" | \"text\"} appearance - The appearance style to apply to the button\n * @attr {boolean} block - If `true`, it will make the button fit to its parent width.\n * @attr {string} border - The corner radius of the button\n * @attr {boolean} disabled - If `true`, the button will be disabled (no interaction allowed)\n * @attr {string} download - Tells the browser to treat the linked URL as a download. Only used when `href` is set.\n * @attr {string} href - When set, the underlying button will be rendered as an `<a>` with this `href` instead of a `<button>`\n * @attr {\"left\" | \"center\" | \"right\"} justify-content - It determinate how the content should be aligned\n * @attr {boolean} loading - If `true` it will display the button in a loading state\n * @attr {\"small\" | \"medium\" | \"large\"} size - The size of the button\n * @attr {\"_blank\" | \"_parent\" | \"_self\" | \"_top\"} target - Where to display the linked URL, as the name for a browsing context (a `tab`, `window`, or `<iframe>`)\n * @attr {\"button\" | \"submit\" | \"reset\"} type - The default behavior of the button\n * @attr {\"standard\" | \"ghost\" | \"danger\"} variant - The variant of button to apply on top of the appearance (applicable only to `appearance=\"primary\"`)\n *\n * @event bqBlur - Handler to be called when the button loses focus\n * @event bqFocus - Handler to be called when button gets focus\n * @event bqClick - Handler to be called when the button is clicked\n *\n * @slot prefix - The prefix content to be displayed before the button label\n * @slot - The button label content\n * @slot suffix - The suffix content to be displayed after the button label\n *\n * @part button - The `<a>` or `<button>` HTML element used under the hood.\n * @part prefix - The `<span>` tag element that acts as prefix container.\n * @part label - The `<span>` tag element that renders the text of the button.\n * @part suffix - The `<span>` tag element that acts as suffix container.\n *\n * @cssprop --bq-button--border-color - Button border color\n * @cssprop --bq-button--border-radius - Button border radius\n * @cssprop --bq-button--border-style - Button border style\n * @cssprop --bq-button--border-width - Button border width\n * @cssprop --bq-button--small-height - Button small height\n * @cssprop --bq-button--small-paddingX - Button small padding block (top and bottom)\n * @cssprop --bq-button--small-paddingY - Button small padding inline (left and right)\n * @cssprop --bq-button--small-font-size - Button small font size\n * @cssprop --bq-button--medium-height - Button medium height\n * @cssprop --bq-button--medium-paddingX - Button medium padding block (top and bottom)\n * @cssprop --bq-button--medium-paddingY - Button medium padding inline (left and right)\n * @cssprop --bq-button--medium-font-size - Button medium font size\n * @cssprop --bq-button--large-height - Button large height\n * @cssprop --bq-button--large-paddingX - Button large padding block (top and bottom)\n * @cssprop --bq-button--large-paddingY - Button large padding inline (left and right)\n * @cssprop --bq-button--large-font-size - Button large font size\n */\n@Component({\n tag: 'bq-button',\n styleUrl: './scss/bq-button.scss',\n formAssociated: true,\n shadow: {\n delegatesFocus: true,\n },\n})\nexport class BqButton {\n // Own Properties\n // ====================\n\n private prefixElem: HTMLElement;\n private suffixElem: HTMLElement;\n\n // Reference to host HTML element\n // ===================================\n\n @Element() el!: HTMLBqButtonElement;\n @AttachInternals() internals!: ElementInternals;\n\n // State() variables\n // Inlined decorator, alphabetical order\n // =======================================\n\n @State() private hasPrefix = false;\n @State() private hasSuffix = false;\n\n // Public Property API\n // ========================\n\n /** The appearance style to apply to the button */\n @Prop({ reflect: true }) appearance: TButtonAppearance = 'primary';\n\n /** If `true`, it will make the button fit to its parent width. */\n @Prop({ reflect: true }) block: boolean = false;\n\n /** The corner radius of the button */\n @Prop({ reflect: true }) border: TButtonBorderRadius = 'm';\n\n /** If true, the button will be disabled (no interaction allowed) */\n @Prop() disabled = false;\n\n /**\n * Tells the browser to treat the linked URL as a download. Only used when `href` is set.\n * Details: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-download\n */\n @Prop() download?: string;\n\n /** When set, the underlying button will be rendered as an `<a>` with this `href` instead of a `<button>` */\n @Prop({ reflect: true }) href: string;\n\n /** It determinate how the content should be aligned */\n @Prop({ reflect: true }) justifyContent: 'left' | 'center' | 'right' = 'center';\n\n /** If `true` it will display the button in a loading state */\n @Prop() loading = false;\n\n /** The size of the button */\n @Prop({ reflect: true }) size: TButtonSize = 'medium';\n\n /**\n * Where to display the linked URL, as the name for a browsing context (a `tab`, `window`, or `<iframe>`)\n * Details: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-target\n */\n @Prop({ reflect: true }) target: '_blank' | '_parent' | '_self' | '_top';\n\n /** The default behavior of the button */\n @Prop({ reflect: true }) type: TButtonType = 'button';\n\n /** The variant of button to apply on top of the appearance (applicable only to `appearance=\"primary\"`) */\n @Prop({ reflect: true }) variant: TButtonVariant = 'standard';\n\n // Prop lifecycle events\n // =======================\n\n @Watch('appearance')\n @Watch('type')\n @Watch('size')\n @Watch('variant')\n checkPropValues() {\n validatePropValue(BUTTON_APPEARANCE, 'primary', this.el, 'appearance');\n validatePropValue(BUTTON_TYPE, 'button', this.el, 'type');\n validatePropValue(BUTTON_SIZE, 'medium', this.el, 'size');\n validatePropValue(BUTTON_VARIANT, 'standard', this.el, 'variant');\n }\n\n // Events section\n // Requires JSDocs for public API documentation\n // ==============================================\n\n /** Handler to be called when the button loses focus */\n @Event() bqBlur: EventEmitter<HTMLBqButtonElement>;\n\n /** Handler to be called when the button is clicked */\n @Event() bqFocus: EventEmitter<HTMLBqButtonElement>;\n\n /** Handler to be called when button gets focus */\n @Event() bqClick: EventEmitter<HTMLBqButtonElement>;\n\n // Component lifecycle events\n // Ordered by their natural call order\n // =====================================\n\n componentWillLoad() {\n this.checkPropValues();\n }\n\n componentDidLoad() {\n this.handleSlotChange();\n }\n\n // Listeners\n // ==============\n\n // Public methods API\n // These methods are exposed on the host element.\n // Always use two lines.\n // Public Methods must be async.\n // Requires JSDocs for public API documentation.\n // ===============================================\n\n // Local methods\n // Internal business logic.\n // These methods cannot be called from the host element.\n // =======================================================\n\n private handleBlur = () => {\n this.bqBlur.emit(this.el);\n };\n\n private handleFocus = () => {\n this.bqFocus.emit(this.el);\n };\n\n private handleClick = (ev: Event) => {\n const { disabled, loading, bqClick, el } = this;\n\n if (disabled || loading) {\n this.preventEvent(ev);\n return;\n }\n\n const bqClickEvent = bqClick.emit(el);\n if (bqClickEvent.defaultPrevented) {\n this.preventEvent(ev);\n return;\n }\n\n this.handleFormAction();\n };\n\n private handleFormAction() {\n const {\n type,\n internals: { form },\n } = this;\n if (isNil(form)) return;\n\n const formAction = this.formActions(form)[type];\n if (isNil(formAction)) return;\n\n formAction();\n }\n\n private formActions = (form: HTMLFormElement) => ({\n submit: () => this.submitAssociatedForm(form),\n reset: () => form.reset(),\n });\n\n private submitAssociatedForm = (form: HTMLFormElement) => {\n if (!isClient() || isNil(form)) return;\n\n const btn = document.createElement('button');\n btn.type = this.type;\n btn.hidden = true;\n form.append(btn);\n\n btn.click();\n btn.remove();\n };\n\n private handleSlotChange = () => {\n this.hasPrefix = hasSlotContent(this.prefixElem, 'prefix');\n this.hasSuffix = hasSlotContent(this.suffixElem, 'suffix');\n };\n\n private preventEvent(ev: Event) {\n ev.preventDefault();\n ev.stopPropagation();\n }\n\n // render() function\n // Always the last one in the class.\n // ===================================\n\n render() {\n const isLink = isDefined(this.href);\n const TagElem = isLink ? 'a' : 'button';\n const style = {\n ...(this.border && { '--bq-button--border-radius': `var(--bq-radius--${this.border})` }),\n };\n\n return (\n <Host style={style}>\n <TagElem\n class={{\n 'bq-button': true,\n [`bq-button--${this.appearance}`]: true,\n [`content-${this.justifyContent}`]: true,\n [`${this.variant}`]: true,\n [`${this.size}`]: true,\n block: this.block,\n disabled: this.disabled,\n 'has-prefix': this.hasPrefix,\n 'has-suffix': this.hasSuffix,\n loading: this.loading,\n }}\n aria-disabled={this.disabled ? 'true' : 'false'}\n disabled={this.disabled}\n download={isLink ? this.download : undefined}\n href={isLink ? this.href : undefined}\n part=\"button\"\n rel={isLink && this.target ? 'noreferrer noopener' : undefined}\n target={isLink ? this.target : undefined}\n type={this.type}\n tabIndex={this.disabled ? -1 : 0}\n onBlur={this.handleBlur}\n onFocus={this.handleFocus}\n onClick={this.handleClick}\n >\n <span class=\"bq-button__prefix\" ref={(spanElem) => (this.prefixElem = spanElem)} part=\"prefix\">\n <slot name=\"prefix\" onSlotchange={this.handleSlotChange} />\n </span>\n <span class=\"bq-button__label\" part=\"label\">\n <slot />\n </span>\n <span class=\"bq-button__suffix\" ref={(spanElem) => (this.suffixElem = spanElem)} part=\"suffix\">\n <slot name=\"suffix\" onSlotchange={this.handleSlotChange} />\n </span>\n {this.loading && <bq-icon class=\"bq-button__loader\" name=\"spinner-gap\" />}\n </TagElem>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"bq-button.js","sourceRoot":"","sources":["../../../../../../packages/beeq/src/components/button/bq-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAGxG,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAQhG,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEnG;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { AttachInternals, Component, Element, Event, h, Host, Prop, State, Watch } from '@stencil/core';\nimport type { EventEmitter } from '@stencil/core';\n\nimport { BUTTON_APPEARANCE, BUTTON_SIZE, BUTTON_TYPE, BUTTON_VARIANT } from './bq-button.types';\nimport type {\n TButtonAppearance,\n TButtonBorderRadius,\n TButtonSize,\n TButtonType,\n TButtonVariant,\n} from './bq-button.types';\nimport { hasSlotContent, isClient, isDefined, isNil, validatePropValue } from '../../shared/utils';\n\n/**\n * Buttons are designed for users to take action on a page or a screen.\n *\n * @example How to use it\n * ```html\n * <bq-button appearance=\"primary\" border=\"m\" size=\"medium\">\n * <bq-icon name=\"arrow-circle-left\" slot=\"prefix\"></bq-icon>\n * Go back\n * </bq-button>\n * ```\n *\n * @documentation https://www.beeq.design/3d466e231/p/286b43-buttons\n * @status stable\n *\n * @dependency bq-icon\n *\n * @attr {\"primary\" | \"secondary\" | \"link\" | \"text\"} appearance - The appearance style to apply to the button\n * @attr {boolean} block - If `true`, it will make the button fit to its parent width.\n * @attr {string} border - The corner radius of the button\n * @attr {boolean} disabled - If `true`, the button will be disabled (no interaction allowed)\n * @attr {string} download - Tells the browser to treat the linked URL as a download. Only used when `href` is set.\n * @attr {string} href - When set, the underlying button will be rendered as an `<a>` with this `href` instead of a `<button>`\n * @attr {\"left\" | \"center\" | \"right\"} justify-content - It determinate how the content should be aligned\n * @attr {boolean} loading - If `true` it will display the button in a loading state\n * @attr {\"small\" | \"medium\" | \"large\"} size - The size of the button\n * @attr {\"_blank\" | \"_parent\" | \"_self\" | \"_top\"} target - Where to display the linked URL, as the name for a browsing context (a `tab`, `window`, or `<iframe>`)\n * @attr {\"button\" | \"submit\" | \"reset\"} type - The default behavior of the button\n * @attr {\"standard\" | \"ghost\" | \"danger\"} variant - The variant of button to apply on top of the appearance (applicable only to `appearance=\"primary\"`)\n *\n * @event bqBlur - Handler to be called when the button loses focus\n * @event bqFocus - Handler to be called when button gets focus\n * @event bqClick - Handler to be called when the button is clicked\n *\n * @slot prefix - The prefix content to be displayed before the button label\n * @slot - The button label content\n * @slot suffix - The suffix content to be displayed after the button label\n *\n * @part button - The `<a>` or `<button>` HTML element used under the hood.\n * @part prefix - The `<span>` tag element that acts as prefix container.\n * @part label - The `<span>` tag element that renders the text of the button.\n * @part suffix - The `<span>` tag element that acts as suffix container.\n *\n * @cssprop --bq-button--border-color - Button border color\n * @cssprop --bq-button--border-radius - Button border radius\n * @cssprop --bq-button--border-style - Button border style\n * @cssprop --bq-button--border-width - Button border width\n * @cssprop --bq-button--small-height - Button small height\n * @cssprop --bq-button--small-paddingX - Button small padding block (top and bottom)\n * @cssprop --bq-button--small-paddingY - Button small padding inline (left and right)\n * @cssprop --bq-button--small-font-size - Button small font size\n * @cssprop --bq-button--medium-height - Button medium height\n * @cssprop --bq-button--medium-paddingX - Button medium padding block (top and bottom)\n * @cssprop --bq-button--medium-paddingY - Button medium padding inline (left and right)\n * @cssprop --bq-button--medium-font-size - Button medium font size\n * @cssprop --bq-button--large-height - Button large height\n * @cssprop --bq-button--large-paddingX - Button large padding block (top and bottom)\n * @cssprop --bq-button--large-paddingY - Button large padding inline (left and right)\n * @cssprop --bq-button--large-font-size - Button large font size\n */\n@Component({\n tag: 'bq-button',\n styleUrl: './scss/bq-button.scss',\n formAssociated: true,\n shadow: {\n delegatesFocus: true,\n },\n})\nexport class BqButton {\n // Own Properties\n // ====================\n\n private prefixElem: HTMLElement;\n private suffixElem: HTMLElement;\n\n // Reference to host HTML element\n // ===================================\n\n @Element() el!: HTMLBqButtonElement;\n @AttachInternals() internals!: ElementInternals;\n\n // State() variables\n // Inlined decorator, alphabetical order\n // =======================================\n\n @State() private hasPrefix = false;\n @State() private hasSuffix = false;\n\n // Public Property API\n // ========================\n\n /** The appearance style to apply to the button */\n @Prop({ reflect: true }) appearance: TButtonAppearance = 'primary';\n\n /** If `true`, it will make the button fit to its parent width. */\n @Prop({ reflect: true }) block: boolean = false;\n\n /** The corner radius of the button */\n @Prop({ reflect: true }) border: TButtonBorderRadius = 'm';\n\n /** If true, the button will be disabled (no interaction allowed) */\n @Prop() disabled = false;\n\n /**\n * Tells the browser to treat the linked URL as a download. Only used when `href` is set.\n * Details: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-download\n */\n @Prop() download?: string;\n\n /** When set, the underlying button will be rendered as an `<a>` with this `href` instead of a `<button>` */\n @Prop({ reflect: true }) href: string;\n\n /** It determinate how the content should be aligned */\n @Prop({ reflect: true }) justifyContent: 'left' | 'center' | 'right' = 'center';\n\n /** If `true` it will display the button in a loading state */\n @Prop() loading = false;\n\n /** The size of the button */\n @Prop({ reflect: true }) size: TButtonSize = 'medium';\n\n /**\n * Where to display the linked URL, as the name for a browsing context (a `tab`, `window`, or `<iframe>`)\n * Details: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-target\n */\n @Prop({ reflect: true }) target: '_blank' | '_parent' | '_self' | '_top';\n\n /** The default behavior of the button */\n @Prop({ reflect: true }) type: TButtonType = 'button';\n\n /** The variant of button to apply on top of the appearance (applicable only to `appearance=\"primary\"`) */\n @Prop({ reflect: true }) variant: TButtonVariant = 'standard';\n\n // Prop lifecycle events\n // =======================\n\n @Watch('appearance')\n @Watch('type')\n @Watch('size')\n @Watch('variant')\n checkPropValues() {\n validatePropValue(BUTTON_APPEARANCE, 'primary', this.el, 'appearance');\n validatePropValue(BUTTON_TYPE, 'button', this.el, 'type');\n validatePropValue(BUTTON_SIZE, 'medium', this.el, 'size');\n validatePropValue(BUTTON_VARIANT, 'standard', this.el, 'variant');\n }\n\n // Events section\n // Requires JSDocs for public API documentation\n // ==============================================\n\n /** Handler to be called when the button loses focus. */\n @Event() bqBlur: EventEmitter<HTMLBqButtonElement>;\n\n /** Handler to be called when the button gets focus. */\n @Event() bqFocus: EventEmitter<HTMLBqButtonElement>;\n\n /** Handler to be called when the button is clicked. */\n @Event() bqClick: EventEmitter<HTMLBqButtonElement>;\n\n // Component lifecycle events\n // Ordered by their natural call order\n // =====================================\n\n componentWillLoad() {\n this.checkPropValues();\n }\n\n componentDidLoad() {\n this.handleSlotChange();\n }\n\n // Listeners\n // ==============\n\n // Public methods API\n // These methods are exposed on the host element.\n // Always use two lines.\n // Public Methods must be async.\n // Requires JSDocs for public API documentation.\n // ===============================================\n\n // Local methods\n // Internal business logic.\n // These methods cannot be called from the host element.\n // =======================================================\n\n private handleBlur = () => {\n this.bqBlur.emit(this.el);\n };\n\n private handleFocus = () => {\n this.bqFocus.emit(this.el);\n };\n\n private handleClick = (ev: Event) => {\n const { disabled, loading, bqClick, el } = this;\n\n if (disabled || loading) {\n this.preventEvent(ev);\n return;\n }\n\n const bqClickEvent = bqClick.emit(el);\n if (bqClickEvent.defaultPrevented) {\n this.preventEvent(ev);\n return;\n }\n\n this.handleFormAction();\n };\n\n private handleFormAction() {\n const {\n type,\n internals: { form },\n } = this;\n if (isNil(form)) return;\n\n const formAction = this.formActions(form)[type];\n if (isNil(formAction)) return;\n\n formAction();\n }\n\n private formActions = (form: HTMLFormElement) => ({\n submit: () => this.submitAssociatedForm(form),\n reset: () => form.reset(),\n });\n\n private submitAssociatedForm = (form: HTMLFormElement) => {\n if (!isClient() || isNil(form)) return;\n\n const btn = document.createElement('button');\n btn.type = this.type;\n btn.hidden = true;\n form.append(btn);\n\n btn.click();\n btn.remove();\n };\n\n private handleSlotChange = () => {\n this.hasPrefix = hasSlotContent(this.prefixElem, 'prefix');\n this.hasSuffix = hasSlotContent(this.suffixElem, 'suffix');\n };\n\n private preventEvent(ev: Event) {\n ev.preventDefault();\n ev.stopPropagation();\n }\n\n // render() function\n // Always the last one in the class.\n // ===================================\n\n render() {\n const isLink = isDefined(this.href);\n const TagElem = isLink ? 'a' : 'button';\n const style = {\n ...(this.border && { '--bq-button--border-radius': `var(--bq-radius--${this.border})` }),\n };\n\n return (\n <Host style={style}>\n <TagElem\n class={{\n 'bq-button': true,\n [`bq-button--${this.appearance}`]: true,\n [`content-${this.justifyContent}`]: true,\n [`${this.variant}`]: true,\n [`${this.size}`]: true,\n block: this.block,\n disabled: this.disabled,\n 'has-prefix': this.hasPrefix,\n 'has-suffix': this.hasSuffix,\n loading: this.loading,\n }}\n aria-disabled={this.disabled ? 'true' : 'false'}\n disabled={this.disabled}\n download={isLink ? this.download : undefined}\n href={isLink ? this.href : undefined}\n part=\"button\"\n rel={isLink && this.target ? 'noreferrer noopener' : undefined}\n target={isLink ? this.target : undefined}\n type={this.type}\n tabIndex={this.disabled ? -1 : 0}\n onBlur={this.handleBlur}\n onFocus={this.handleFocus}\n onClick={this.handleClick}\n >\n <span class=\"bq-button__prefix\" ref={(spanElem) => (this.prefixElem = spanElem)} part=\"prefix\">\n <slot name=\"prefix\" onSlotchange={this.handleSlotChange} />\n </span>\n <span class=\"bq-button__label\" part=\"label\">\n <slot />\n </span>\n <span class=\"bq-button__suffix\" ref={(spanElem) => (this.suffixElem = spanElem)} part=\"suffix\">\n <slot name=\"suffix\" onSlotchange={this.handleSlotChange} />\n </span>\n {this.loading && <bq-icon class=\"bq-button__loader\" name=\"spinner-gap\" />}\n </TagElem>\n </Host>\n );\n }\n}\n"]}
@@ -133,6 +133,7 @@ export class BqDatePicker {
133
133
  // ====================
134
134
  callyElem;
135
135
  inputElem;
136
+ isInternalUpdate = false;
136
137
  labelElem;
137
138
  prefixElem;
138
139
  suffixElem;
@@ -240,18 +241,16 @@ export class BqDatePicker {
240
241
  value;
241
242
  // Prop lifecycle events
242
243
  // =======================
243
- handleValueChange() {
244
- const { formatDisplayValue, internals, isCallyLoaded, value } = this;
244
+ handleValueChange(newValue, oldValue) {
245
+ if (newValue === oldValue)
246
+ return;
247
+ const { formatDisplayValue, internals, isCallyLoaded } = this;
245
248
  if (!isCallyLoaded)
246
249
  return;
247
- internals.setFormValue(!isNil(value) ? `${value}` : undefined);
250
+ internals.setFormValue(!isNil(newValue) ? `${newValue}` : undefined);
248
251
  this.updateFormValidity();
249
- if (Array.isArray(value)) {
250
- this.hasValue = value.some((val) => val.length > 0);
251
- return;
252
- }
253
- this.hasValue = isDefined(value);
254
- this.displayDate = formatDisplayValue(value);
252
+ this.hasValue = isDefined(newValue);
253
+ this.displayDate = formatDisplayValue(newValue);
255
254
  this.setFocusedDate();
256
255
  }
257
256
  checkPropValues() {
@@ -285,9 +284,14 @@ export class BqDatePicker {
285
284
  console.error(error);
286
285
  }
287
286
  }
288
- async componentDidLoad() {
287
+ componentDidLoad() {
289
288
  this.handleSlotChange();
290
- this.handleValueChange();
289
+ this.handleValueChange(this.value, undefined);
290
+ }
291
+ componentDidRender() {
292
+ if (this.isInternalUpdate) {
293
+ this.isInternalUpdate = false;
294
+ }
291
295
  }
292
296
  formAssociatedCallback() {
293
297
  this.updateFormValidity();
@@ -300,10 +304,12 @@ export class BqDatePicker {
300
304
  // Listeners
301
305
  // ==============
302
306
  handleOpenChange(ev) {
303
- if (!ev.composedPath().includes(this.el))
307
+ if (!isEventTargetChildOfElement(ev, this.el))
304
308
  return;
305
- this.open = ev.detail.open;
306
- this.setFocusedDate();
309
+ const { open } = ev.detail;
310
+ if (this.open === open)
311
+ return;
312
+ this.open = open;
307
313
  }
308
314
  handleClickOutside(ev) {
309
315
  const { open, type, hasRangeEnd } = this;
@@ -311,12 +317,8 @@ export class BqDatePicker {
311
317
  return;
312
318
  if (isEventTargetChildOfElement(ev, this.el) || hasRangeEnd)
313
319
  return;
314
- if (isEventTargetChildOfElement(ev, this.el))
315
- return;
316
- if (!hasRangeEnd) {
317
- this.tentative = undefined;
318
- this.hasRangeEnd = false;
319
- }
320
+ this.tentative = undefined;
321
+ this.hasRangeEnd = false;
320
322
  }
321
323
  // Public methods API
322
324
  // These methods are exposed on the host element.
@@ -355,17 +357,20 @@ export class BqDatePicker {
355
357
  const { callyElem, formatFocusedDate, isCallyLoaded, value } = this;
356
358
  if (!(callyElem && isCallyLoaded))
357
359
  return;
358
- // We need to set the focused date in the calendar component via a ref
359
- // because it doesn't work when passed as a prop (the Cally element does not re-render)
360
- this.focusedDate = value ? formatFocusedDate(value) : new Date().toLocaleDateString('fr-CA');
361
- this.callyElem.focusedDate = this.focusedDate;
360
+ const nextFocused = value ? formatFocusedDate(value) : new Date().toLocaleDateString('fr-CA');
361
+ if (this.focusedDate === nextFocused)
362
+ return;
363
+ this.focusedDate = nextFocused;
364
+ if (callyElem.focusedDate !== this.focusedDate) {
365
+ // We need to set the focused date in the calendar component via a ref
366
+ // because it doesn't work when passed as a prop (the Cally element does not re-render)
367
+ callyElem.focusedDate = this.focusedDate;
368
+ }
362
369
  };
363
370
  handleChange = (ev) => {
364
- if (this.disabled)
371
+ if (this.disabled || !isHTMLElement(ev.target, 'input'))
365
372
  return;
366
- if (!isHTMLElement(ev.target, 'input'))
367
- return;
368
- const dateValue = new Date(ev.target.value);
373
+ const dateValue = new Date(ev.target.value + 'T00:00:00');
369
374
  if (!isNaN(dateValue.getTime())) {
370
375
  // We need to force the value to respect the format: yyyy-mm-dd, hence the hardcoded locale
371
376
  this.value = dateValue.toLocaleDateString('fr-CA');
@@ -375,18 +380,26 @@ export class BqDatePicker {
375
380
  }
376
381
  };
377
382
  handleCalendarChange = (ev) => {
378
- const { value } = ev.target;
383
+ if (this.isInternalUpdate)
384
+ return;
385
+ const shouldStayOpen = this.type === 'multi';
386
+ const value = ev.target.value;
387
+ if (this.value === value) {
388
+ this.open = shouldStayOpen;
389
+ return;
390
+ }
391
+ this.isInternalUpdate = true;
379
392
  this.value = value;
380
- this.displayDate = this.formatDisplayValue(this.value);
393
+ this.displayDate = this.formatDisplayValue(value);
381
394
  this.inputElem.value = this.displayDate;
382
395
  this.inputElem.focus();
383
- this.internals.setFormValue(`${this.value}`);
396
+ this.internals.setFormValue(value);
384
397
  this.bqChange.emit({ value: this.value, el: this.el });
385
- this.open = this.type === 'multi';
398
+ this.open = shouldStayOpen;
386
399
  };
387
400
  handleCalendarRangeStart = (ev) => {
388
401
  this.hasRangeEnd = false;
389
- this.tentative = new Date(ev.detail).toLocaleDateString('fr-CA');
402
+ this.tentative = ev.detail;
390
403
  };
391
404
  handleCalendarRangeEnd = () => {
392
405
  this.hasRangeEnd = true;
@@ -458,14 +471,14 @@ export class BqDatePicker {
458
471
  return undefined;
459
472
  const dateFormatter = new Intl.DateTimeFormat(this.locale, this.formatOptions);
460
473
  if (this.type === 'range') {
461
- const [start, end] = value.split('/').map((dateStr) => new Date(dateStr));
474
+ const [start, end] = value.split('/').map((dateStr) => new Date(dateStr + 'T00:00:00'));
462
475
  return dateFormatter.formatRange(start, end);
463
476
  }
464
477
  if (this.type === 'multi') {
465
- const dates = value.split(' ').map((dateStr) => new Date(dateStr));
478
+ const dates = value.split(' ').map((dateStr) => new Date(dateStr + 'T00:00:00'));
466
479
  return dates.map((date) => dateFormatter.format(date)).join(', ');
467
480
  }
468
- return dateFormatter.format(new Date(value));
481
+ return dateFormatter.format(new Date(value + 'T00:00:00'));
469
482
  };
470
483
  updateFormValidity = () => {
471
484
  const { formValidationMessage, internals, required, value, inputElem } = this;
@@ -474,7 +487,7 @@ export class BqDatePicker {
474
487
  if (required && (!value || value.toString().trim() === '')) {
475
488
  // Set validity state to invalid
476
489
  internals?.states.add('invalid');
477
- internals?.setValidity({ valueMissing: true }, formValidationMessage, inputElem);
490
+ internals?.setValidity({ valueMissing: true }, formValidationMessage ?? 'Please, input or select a valid date', inputElem);
478
491
  return;
479
492
  }
480
493
  // Set validity state to valid if textarea has value or is not required
@@ -496,16 +509,16 @@ export class BqDatePicker {
496
509
  render() {
497
510
  const CallyCalendar = this.CalendarType;
498
511
  const labelId = `bq-date-picker__label-${this.name || this.fallbackInputId}`;
499
- return (h("div", { key: '90e43244086cd211ea29a2e4c2b38a53d61fb6e3', class: "bq-date-picker", part: "base" }, h("label", { key: 'afa9d4e4c5b1961155f96b5cf2c862491fe252e8', id: labelId, class: { 'bq-date-picker__label': true, '!hidden': !this.hasLabel }, "aria-label": this.name || this.fallbackInputId, htmlFor: this.name || this.fallbackInputId, ref: (labelElem) => (this.labelElem = labelElem), part: "label" }, h("slot", { key: '0e6087b6d570604cfa0ff6c0199ee15b4509fb1f', name: "label", onSlotchange: this.handleSlotChange })), h("bq-dropdown", { key: 'e5314f0cec550603250010c170872823df644a66', class: "bq-date-picker__dropdown is-full [&::part(panel)]:p-m [&::part(panel)]:is-auto", disabled: this.disabled, distance: this.distance, open: this.open, panelHeight: this.panelHeight, placement: this.placement, skidding: this.skidding, strategy: this.strategy, exportparts: "panel" }, h("div", { key: 'cc9a24028deb548153c81be9269c26ee7d4be8c9', class: {
512
+ return (h("div", { key: '70f13329ea64ee9b34923e4a63f15567b8599647', class: "bq-date-picker", part: "base" }, h("label", { key: '380eff87152f9f1b32c6a245fb1076c9bfd49718', id: labelId, class: { 'bq-date-picker__label': true, '!hidden': !this.hasLabel }, "aria-label": this.name || this.fallbackInputId, htmlFor: this.name || this.fallbackInputId, ref: (labelElem) => (this.labelElem = labelElem), part: "label" }, h("slot", { key: '8c2af1ac6b86069943ee9f800fca5e34a8330de8', name: "label", onSlotchange: this.handleSlotChange })), h("bq-dropdown", { key: 'f2a23bdfa18984900b54414f9f9adedcffd7da44', class: "bq-date-picker__dropdown is-full [&::part(panel)]:p-m [&::part(panel)]:is-auto", disabled: this.disabled, distance: this.distance, open: this.open, panelHeight: this.panelHeight, placement: this.placement, skidding: this.skidding, strategy: this.strategy, exportparts: "panel" }, h("div", { key: 'da8b3eee06bba4fba6a6bd0afa34f276013e3e24', class: {
500
513
  'bq-date-picker__control': true,
501
514
  [`validation-${this.validationStatus}`]: true,
502
515
  disabled: this.disabled,
503
- }, part: "control", slot: "trigger" }, h("span", { key: 'b548441675b48af77eeff1cd2a7ab94b6e722a2c', class: { 'bq-date-picker__control--prefix': true, '!hidden': !this.hasPrefix }, ref: (spanElem) => (this.prefixElem = spanElem), part: "prefix" }, h("slot", { key: 'e0f4ab4a054073c602cf4ec89ce0fb2edcbc4502', name: "prefix", onSlotchange: this.handleSlotChange })), h("input", { key: '548cf75c23c5ba24fe800f5edc882e9af0a712d2', id: this.name || this.fallbackInputId, class: "bq-date-picker__control--input", autoComplete: "off", autoCapitalize: "off", "aria-disabled": this.disabled ? 'true' : 'false', "aria-controls": `${this.name}`, "aria-haspopup": "dialog", disabled: this.disabled, form: this.form, name: this.name, placeholder: this.placeholder, readonly: this.type !== 'single', ref: (inputElem) => (this.inputElem = inputElem), required: this.required, spellcheck: false, type: "text", value: this.displayDate, part: "input",
516
+ }, part: "control", slot: "trigger" }, h("span", { key: '7c02c1554af91b2bd5500b88c0e5d727603a2b9b', class: { 'bq-date-picker__control--prefix': true, '!hidden': !this.hasPrefix }, ref: (spanElem) => (this.prefixElem = spanElem), part: "prefix" }, h("slot", { key: '103cc4ffe2cb2b37a4cc232a69ef78b6e8b8c6e4', name: "prefix", onSlotchange: this.handleSlotChange })), h("input", { key: '39cd9c82215df7a7e6fc0460915328056f221978', id: this.name || this.fallbackInputId, class: "bq-date-picker__control--input", autoComplete: "off", autoCapitalize: "off", "aria-disabled": this.disabled ? 'true' : 'false', "aria-controls": `${this.name}`, "aria-haspopup": "dialog", disabled: this.disabled, form: this.form, name: this.name, placeholder: this.placeholder, readonly: this.type !== 'single', ref: (inputElem) => (this.inputElem = inputElem), required: this.required, spellcheck: false, type: "text", value: this.displayDate, part: "input",
504
517
  // Events
505
518
  onBlur: this.handleBlur, onFocus: this.handleFocus, onChange: this.handleChange }), this.hasValue && !this.disabled && !this.disableClear && (
506
519
  // The clear button will be visible as long as the input has a value
507
520
  // and the parent group is hovered or has focus-within
508
- h("bq-button", { key: '94c186cfce884edd7c2d63a49f6533d8448fb683', class: "bq-date-picker__control--clear ms-[--bq-date-picker--gap] hidden", appearance: "text", "aria-label": this.clearButtonLabel, size: "small", onBqClick: this.handleClearClick, part: "clear-btn", exportparts: "button" }, h("slot", { key: 'f0caaec8283a7ca0298b82f157bd36933b0541b4', name: "clear-icon" }, h("bq-icon", { key: '2549f5bce9f4d7e836ff5babaa04750831482b40', name: "x-circle", class: "flex" })))), h("span", { key: '8c504c8a885061eec62e4704e425b5f3779cd69e', class: "bq-date-picker__control--suffix", ref: (spanElem) => (this.suffixElem = spanElem), part: "suffix" }, h("slot", { key: '8220188ec1b41908b45301503d3351a6038e1dd5', name: "suffix", onSlotchange: this.handleSlotChange }, h("bq-icon", { key: 'ba52169baa77e1103e09fcb538f7ba7067ca5474', name: "calendar-blank", class: "flex" })))), this.isCallyLoaded && (h(CallyCalendar, { key: '7d27a2ab38209ebe4d1801bb235da417321904b4', isDateDisallowed: this.isDateDisallowed, locale: this.locale, value: this.value, min: this.min, max: this.max, months: this.months, tentative: this.tentative, pageBy: this.monthsPerView, firstDayOfWeek: this.firstDayOfWeek, showOutsideDays: this.showOutsideDays, onChange: this.handleCalendarChange, onRangestart: this.handleCalendarRangeStart, onRangeend: this.handleCalendarRangeEnd, exportparts: "container:calendar__container,header:calendar__header,button:calendar__button,previous:calendar__previous,next:calendar__next,disabled:calendar__disabled,heading:calendar__heading", ref: (elem) => (this.callyElem = elem) }, h("bq-icon", { key: '671b9b78eb566a2f4862525e396749e50be679a8', color: "text--primary", slot: "previous", name: "caret-left", label: "Previous" }), h("bq-icon", { key: '6219184ad134f80b515aeb4dd5a52a2efe1ccf8a', color: "text--primary", slot: "next", name: "caret-right", label: "Next" }), h("div", { key: '438fecb7af23bb5a6e10f2e65c310ce904fbae00', class: "flex flex-wrap justify-center gap-[--bq-spacing-m]" }, this.generateCalendarMonths()))))));
521
+ h("bq-button", { key: 'f23e4d77b45f88920d96be228a55af493b0306f4', class: "bq-date-picker__control--clear ms-[--bq-date-picker--gap] hidden", appearance: "text", "aria-label": this.clearButtonLabel, size: "small", onBqClick: this.handleClearClick, part: "clear-btn", exportparts: "button" }, h("slot", { key: 'a0cb283da14c276bdb7851c5c9664b9f5fd2b3a4', name: "clear-icon" }, h("bq-icon", { key: '02663a817097d5426c71569019de176044a247f0', name: "x-circle", class: "flex" })))), h("span", { key: '872be19c196b4a2b7523e22140b9f7b81feab81a', class: "bq-date-picker__control--suffix", ref: (spanElem) => (this.suffixElem = spanElem), part: "suffix" }, h("slot", { key: '5b687ae35fa37326fd83f141c7788e3441ac4e75', name: "suffix", onSlotchange: this.handleSlotChange }, h("bq-icon", { key: 'cbb17aafed0f39fbc14047afb68ce2f18752529e', name: "calendar-blank", class: "flex" })))), this.isCallyLoaded && (h(CallyCalendar, { key: '12185dc3e6650ef7d640e709c5bb3b2ed3ef2a72', isDateDisallowed: this.isDateDisallowed, locale: this.locale, value: this.value, min: this.min, max: this.max, months: this.months, tentative: this.tentative, pageBy: this.monthsPerView, firstDayOfWeek: this.firstDayOfWeek, showOutsideDays: this.showOutsideDays, onChange: this.handleCalendarChange, onRangestart: this.handleCalendarRangeStart, onRangeend: this.handleCalendarRangeEnd, exportparts: "container:calendar__container,header:calendar__header,button:calendar__button,previous:calendar__previous,next:calendar__next,disabled:calendar__disabled,heading:calendar__heading", ref: (elem) => (this.callyElem = elem) }, h("bq-icon", { key: '19820e69ed798053e0b63f6a9d19547244c6f165', color: "text--primary", slot: "previous", name: "caret-left", label: "Previous" }), h("bq-icon", { key: '7e71a521ef61c8eece31eb76b99584f52ea34897', color: "text--primary", slot: "next", name: "caret-right", label: "Next" }), h("div", { key: '62291115d74800609cc82dc200cb40e1ddc464e4', class: "flex flex-wrap justify-center gap-[--bq-spacing-m]" }, this.generateCalendarMonths()))))));
509
522
  }
510
523
  static get is() { return "bq-date-picker"; }
511
524
  static get encapsulation() { return "shadow"; }