winduum 2.2.28 → 3.0.0-next.10

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 (69) hide show
  1. package/package.json +19 -12
  2. package/src/base/defaults.css +3 -0
  3. package/src/base/reset.css +4 -0
  4. package/src/common.d.ts +4 -0
  5. package/src/common.js +9 -1
  6. package/src/components/carousel/content.css +1 -0
  7. package/src/components/carousel/index.d.ts +14 -35
  8. package/src/components/carousel/index.js +75 -194
  9. package/src/components/check/props/default.css +1 -1
  10. package/src/components/control/props/select-picker.css +4 -4
  11. package/src/components/control/props/select.css +2 -2
  12. package/src/components/control/tel-country-code.css +24 -0
  13. package/src/components/details/default.css +14 -0
  14. package/src/components/details/index.css +1 -0
  15. package/src/components/details/index.d.ts +2 -6
  16. package/src/components/details/index.js +7 -72
  17. package/src/components/details/readme.md +2 -5
  18. package/src/components/dialog/content.css +8 -2
  19. package/src/components/dialog/default.css +16 -2
  20. package/src/components/dialog/drawer.css +20 -0
  21. package/src/components/dialog/index.css +1 -0
  22. package/src/components/dialog/index.js +8 -79
  23. package/src/components/dialog/readme.md +1 -5
  24. package/src/components/drawer/content.css +2 -1
  25. package/src/components/drawer/default.css +13 -31
  26. package/src/components/drawer/index.css +3 -0
  27. package/src/components/drawer/index.d.ts +8 -15
  28. package/src/components/drawer/index.js +67 -50
  29. package/src/components/drawer/keyframes/default.css +9 -0
  30. package/src/components/drawer/noscript.css +32 -0
  31. package/src/components/drawer/nosnap.css +32 -0
  32. package/src/components/drawer/props/content.css +2 -2
  33. package/src/components/drawer/props/default.css +6 -0
  34. package/src/components/drawer/scroller.css +32 -0
  35. package/src/components/form/index.d.ts +5 -12
  36. package/src/components/form/index.js +35 -70
  37. package/src/components/heading/lg.css +1 -1
  38. package/src/components/heading/props/default.css +1 -1
  39. package/src/components/heading/sm.css +1 -1
  40. package/src/components/index.css +1 -0
  41. package/src/components/label/props/default.css +3 -2
  42. package/src/components/popover/content.css +7 -94
  43. package/src/components/popover/default.css +16 -3
  44. package/src/components/popover/index.css +2 -0
  45. package/src/components/popover/index.d.ts +14 -18
  46. package/src/components/popover/index.js +40 -80
  47. package/src/components/popover/props/content.css +1 -2
  48. package/src/components/popover/props/default.css +4 -0
  49. package/src/components/popover/readme.md +1 -2
  50. package/src/components/popover/tooltip.css +11 -0
  51. package/src/components/tabs/index.d.ts +2 -2
  52. package/src/components/text/content.css +241 -0
  53. package/src/components/text/default.css +0 -238
  54. package/src/components/text/index.css +2 -0
  55. package/src/components/text/props/content.css +9 -0
  56. package/src/components/text/props/default.css +1 -7
  57. package/src/components/toast/default.css +6 -0
  58. package/src/components/toast/index.js +2 -1
  59. package/src/components/toaster/index.d.ts +1 -0
  60. package/src/components/toaster/index.js +18 -0
  61. package/src/components/tooltip/default.css +8 -8
  62. package/src/polyfill.js +13 -0
  63. package/src/supports.js +15 -0
  64. package/src/utilities/container/props/default.css +3 -3
  65. package/tailwindcss/utilities/animation-trigger-fallback.css +18 -0
  66. package/tailwindcss/utilities/index.css +1 -0
  67. package/tailwindcss/utilities/position.css +203 -0
  68. package/types/index.d.ts +20 -58
  69. package/src/components/dialog/index.d.ts +0 -13
@@ -0,0 +1,32 @@
1
+ .x-drawer-scroller {
2
+ display: flex;
3
+ width: inherit;
4
+ height: inherit;
5
+ overflow: auto clip;
6
+ scrollbar-width: none;
7
+ scroll-behavior: smooth;
8
+ -webkit-overflow-scrolling: touch;
9
+ overscroll-behavior: none;
10
+ scroll-snap-type: x mandatory;
11
+ scroll-timeline: --x-drawer-backdrop x;
12
+
13
+ &::-webkit-scrollbar {
14
+ display: none;
15
+ }
16
+
17
+ &::after {
18
+ content: "";
19
+ min-inline-size: 100dvw;
20
+ scroll-snap-align: end;
21
+ scroll-initial-target: nearest;
22
+ }
23
+
24
+ &:where(.snap-y) {
25
+ overflow: clip auto;
26
+ scroll-timeline: --x-drawer-backdrop y;
27
+
28
+ &::after {
29
+ min-block-size: 100dvh;
30
+ }
31
+ }
32
+ }
@@ -1,5 +1,5 @@
1
1
  export interface ValidateFormOptions {
2
- validateSelectors?: string
2
+ validateSelector?: string
3
3
  validateOptions?: ValidateFieldOptions
4
4
  validateField?: typeof validateField
5
5
  scrollOptions?: ScrollIntoViewOptions
@@ -7,23 +7,16 @@ export interface ValidateFormOptions {
7
7
  }
8
8
 
9
9
  export interface ValidateFieldOptions {
10
- validate?: boolean
11
10
  validationMessage?: string
12
11
  selector?: string
13
- ignoreMatch?: RegExp
14
12
  validitySelector?: string
15
- infoParentSelector?: string
16
- infoSelector?: string
17
13
  infoContent?: string
18
- endParentSelector?: string
19
- endSelector?: string
20
- endContent?: string
21
- validAttribute?: string
14
+ iconParentSelector?: string
15
+ iconSelector?: string
16
+ iconContent?: string
22
17
  validIcon?: string | null
23
- invalidAttribute?: string
24
18
  invalidIcon?: string
25
- activeAttribute?: string
26
19
  }
27
20
 
28
21
  export function validateForm(event: Event | SubmitEvent, options?: ValidateFormOptions): void
29
- export function validateField(element: HTMLElement | SubmitEvent, options?: ValidateFieldOptions): void
22
+ export function validateField(element: HTMLElement, options?: ValidateFieldOptions): void
@@ -1,34 +1,30 @@
1
1
  /**
2
- * @param {Event | SubmitEvent} event
2
+ * @param {SubmitEvent & { target: HTMLFormElement }} event
3
3
  * @param {import("./").ValidateFormOptions} options
4
4
  * @returns void
5
5
  */
6
6
  export const validateForm = (event, options = {}) => {
7
7
  options = {
8
- validateSelectors: '.x-control, .x-check, .x-switch, .x-rating, .x-color',
9
- validateOptions: {
10
- validate: true,
11
- },
8
+ validateSelector: '.x-field',
9
+ validateOptions: {},
12
10
  validateField,
13
11
  submitterLoadingAttribute: 'data-loading',
14
12
  scrollOptions: { behavior: 'smooth', block: 'center' },
15
13
  ...options,
16
14
  }
17
15
 
18
- if (options.validateOptions.validate) {
19
- if (!event.target.checkValidity()) {
20
- event.preventDefault()
21
- event.stopImmediatePropagation()
16
+ if (!event.target.checkValidity()) {
17
+ event.preventDefault()
18
+ event.stopImmediatePropagation()
22
19
 
23
- event.target.querySelector(':invalid').scrollIntoView(options.scrollOptions)
24
- event.target.querySelector(':invalid').focus()
25
- }
26
- else {
27
- event?.submitter?.setAttribute(options.submitterLoadingAttribute, '')
28
- }
20
+ event.target.querySelector(':invalid').scrollIntoView(options.scrollOptions)
21
+ event.target.querySelector(':invalid').focus()
22
+ }
23
+ else if (options.submitterLoadingAttribute) {
24
+ event?.submitter?.setAttribute(options.submitterLoadingAttribute, '')
29
25
  }
30
26
 
31
- event.target.querySelectorAll(options.validateSelectors).forEach((element) => {
27
+ event.target.querySelectorAll(options.validateSelector).forEach((element) => {
32
28
  options.validateField(element, options.validateOptions)
33
29
  })
34
30
  }
@@ -40,73 +36,42 @@ export const validateForm = (event, options = {}) => {
40
36
  */
41
37
  export const validateField = (element, options = {}) => {
42
38
  options = {
43
- validate: true,
44
- selector: 'input:not([type="hidden"]), textarea, select',
45
- ignoreMatch: /(data-novalidate|readonly)/,
46
- validitySelector: '.validity',
47
- infoParentSelector: '.x-field',
48
- infoSelector: '.x-info',
49
- infoContent: '<div class="x-info text-error validity"></div>',
50
- endParentSelector: '.x-control',
51
- endSelector: '.ms-auto',
52
- endContent: '<div class="ms-auto"></div>',
53
- validAttribute: 'data-valid',
39
+ selector: ':is(input:not([type="hidden"]), textarea, select):not([readonly], [data-novalidate])',
40
+ validitySelector: '[data-validity]',
41
+ infoContent: '<div class="x-info text-error" data-validity></div>',
42
+ iconParentSelector: '.x-control',
43
+ iconSelector: '.ms-auto',
44
+ iconContent: '<div class="ms-auto"></div>',
54
45
  validIcon: null,
55
- invalidAttribute: 'data-invalid',
56
- invalidIcon: '<svg class="text-error validity" aria-hidden="true"><use href="#icon-exclamation-circle"></use></svg>',
57
- activeAttribute: 'data-active',
46
+ invalidIcon: '<svg class="text-error" data-validity aria-hidden="true"><use href="#heroicons-outline/exclamation-circle"></use></svg>',
58
47
  ...options,
59
48
  }
60
49
 
61
- if (!element.querySelector(options.selector)) return
62
-
63
- const validationElement = element.querySelector(options.selector)
64
- const validationMessage = options.validationMessage ?? validationElement.dataset.validationMessage ?? validationElement.validationMessage
65
- const infoParentElement = validationElement?.closest(options.infoParentSelector)
66
- const endParentElement = validationElement.closest(options.endParentSelector)
67
- const infoSelector = options.infoSelector + options.validitySelector
68
- const endSelector = `${options.endSelector} ${options.validitySelector}`
69
-
70
- const insertIcon = (icon) => {
71
- if (!endParentElement || !icon) return
72
-
73
- if (!element?.querySelector(options.endSelector)) {
74
- element?.insertAdjacentHTML('beforeend', options.endContent)
75
- }
50
+ const validationElements = [...element.querySelectorAll(options.selector)]
76
51
 
77
- element.querySelector(options.endSelector).insertAdjacentHTML('afterbegin', icon)
78
- }
52
+ if (!validationElements.length) return
79
53
 
80
- if (validationElement.value !== '') {
81
- element.setAttribute(options.activeAttribute, '')
82
- }
83
- else {
84
- element.removeAttribute(options.activeAttribute)
85
- }
54
+ element.querySelectorAll(options.validitySelector).forEach(el => el.remove())
86
55
 
87
- if (!validationElement.outerHTML.match(options.ignoreMatch) && options.validate) {
88
- element?.removeAttribute(options.validAttribute)
89
- element?.removeAttribute(options.invalidAttribute)
56
+ const invalidElements = validationElements.filter(validationElement => !validationElement.checkValidity())
90
57
 
91
- infoParentElement?.querySelector(infoSelector)?.remove()
92
- endParentElement?.querySelector(endSelector)?.remove()
58
+ validationElements.forEach((validationElement) => {
59
+ const icon = invalidElements.includes(validationElement) ? options.invalidIcon : options.validIcon
60
+ const iconParentElement = validationElement.closest(options.iconParentSelector)
93
61
 
94
- if (validationElement.checkValidity()) {
95
- element.setAttribute(options.validAttribute, '')
62
+ if (!iconParentElement || !icon) return
96
63
 
97
- insertIcon(options.validIcon)
64
+ if (!iconParentElement.querySelector(options.iconSelector)) {
65
+ iconParentElement.insertAdjacentHTML('beforeend', options.iconContent)
98
66
  }
99
- else {
100
- element.setAttribute(options.invalidAttribute, '')
101
67
 
102
- insertIcon(options.invalidIcon)
68
+ iconParentElement.querySelector(options.iconSelector).insertAdjacentHTML('afterbegin', icon)
69
+ })
103
70
 
104
- if (infoParentElement) {
105
- infoParentElement.insertAdjacentHTML('beforeend', options.infoContent)
106
- infoParentElement.querySelector(infoSelector).textContent = validationMessage
107
- }
108
- }
109
- }
71
+ if (!invalidElements.length) return
72
+
73
+ element.insertAdjacentHTML('beforeend', options.infoContent)
74
+ element.lastElementChild.textContent = options.validationMessage ?? invalidElements[0].dataset.validationMessage ?? invalidElements[0].validationMessage
110
75
  }
111
76
 
112
77
  export default {
@@ -1,3 +1,3 @@
1
1
  .x-heading:is(.lg) {
2
- --x-heading-font-size: var(--text-3xl);
2
+ --x-heading-font-size: var(--text-5xl);
3
3
  }
@@ -2,6 +2,6 @@
2
2
  :host {
3
3
  --x-heading-font-family: var(--font-primary);
4
4
  --x-heading-font-weight: var(--font-weight-semibold);
5
- --x-heading-font-size: var(--text-xl);
5
+ --x-heading-font-size: var(--text-4xl);
6
6
  --x-heading-line-height: calc(1em + 0.375rem);
7
7
  }
@@ -1,3 +1,3 @@
1
1
  .x-heading:is(.sm) {
2
- --x-heading-font-size: var(--text-lg);
2
+ --x-heading-font-size: var(--text-3xl);
3
3
  }
@@ -3,6 +3,7 @@
3
3
  @import "./check/index.css";
4
4
  @import "./color/index.css";
5
5
  @import "./control/index.css";
6
+ @import "./details/index.css";
6
7
  @import "./group/index.css";
7
8
  @import "./heading/index.css";
8
9
  @import "./image/index.css";
@@ -1,5 +1,6 @@
1
1
  :root,
2
2
  :host {
3
- --x-label-font-size: var(--text-sm);
4
- --x-label-line-height: calc(1em + 0.25rem);
3
+ --x-label-font-size: var(--text-2xs);
4
+ --x-label-line-height: calc(1em + 0.125rem);
5
+ --x-label-font-weight: var(--font-weight-medium);
5
6
  }
@@ -2,103 +2,16 @@
2
2
  background-color: var(--x-popover-content-background-color);
3
3
  border-radius: var(--x-popover-content-border-radius);
4
4
  padding: var(--x-popover-content-padding-block) var(--x-popover-content-padding-inline);
5
- z-index: var(--x-popover-content-z-index, var(--z-index-10));
6
- transition-property: var(--default-transition-property);
7
- transition-timing-function: var(--ease-in-out);
8
- transition-duration: var(--default-transition-duration);
9
- transform:
10
- translate(var(--tw-translate-x, 0), var(--tw-translate-y, 0))
11
- scaleX(var(--tw-scale-x, 1)) scaleY(var(--tw-scale-y, 1));
5
+ color: var(--x-popover-content-color);
6
+ font-size: var(--x-popover-font-size);
7
+ transition: inherit;
12
8
  will-change: transform;
13
- inline-size: max-content;
14
- position: absolute;
15
9
 
16
- &:where(.bottom),
17
- & {
18
- transform-origin: top;
10
+ @starting-style {
11
+ scale: var(--x-popover-content-starting-scale);
19
12
  }
20
13
 
21
- &:where(.bottom-start) {
22
- transform-origin: top left;
23
- }
24
-
25
- &:where(.bottom-end) {
26
- inset-inline-end: 0;
27
- transform-origin: top right;
28
- }
29
-
30
- &:where(.right) {
31
- inset-block-start: 0;
32
- inset-inline-start: 100%;
33
- transform-origin: left;
34
- }
35
-
36
- &:where(.right-start) {
37
- transform-origin: left top;
38
- }
39
-
40
- &:where(.right-end) {
41
- inset-block: auto 0;
42
- transform-origin: left bottom;
43
- }
44
-
45
- &:where(.left) {
46
- inset-block-start: 0;
47
- inset-inline-end: 100%;
48
- transform-origin: right;
49
- }
50
-
51
- &:where(.left-start) {
52
- transform-origin: right top;
53
- }
54
-
55
- &:where(.left-end) {
56
- inset-block: auto 0;
57
- transform-origin: right bottom;
58
- }
59
-
60
- &:where(.top) {
61
- inset-block-end: 100%;
62
- transform-origin: bottom;
63
- }
64
-
65
- &:where(.top-start) {
66
- transform-origin: bottom left;
67
- }
68
-
69
- &:where(.top-end) {
70
- inset-inline-end: 0;
71
- transform-origin: bottom right;
72
- }
73
-
74
- &:where(.inline-center) {
75
- --tw-translate-x: -50%;
76
-
77
- inset-inline-start: 50%;
78
- }
79
-
80
- &:where(.block-center) {
81
- --tw-translate-y: -50%;
82
-
83
- inset-block-start: 50%;
84
- }
85
-
86
- &[popover]:not([data-open]) {
87
- --tw-scale-x: var(--x-popover-content-scale-x);
88
- --tw-scale-y: var(--x-popover-content-scale-y);
89
-
90
- opacity: 0%;
91
- pointer-events: none;
92
- }
93
-
94
- &:not([popover]) {
95
- .trigger-focus:not(:focus, :focus-within) > &,
96
- .trigger-hover:not(:hover) > & {
97
- --tw-scale-x: var(--x-popover-content-scale-x);
98
- --tw-scale-y: var(--x-popover-content-scale-y);
99
-
100
- opacity: 0%;
101
- visibility: hidden;
102
- }
14
+ :where(.x-popover:not(:popover-open)) > & {
15
+ scale: var(--x-popover-content-starting-scale);
103
16
  }
104
17
  }
@@ -1,4 +1,17 @@
1
1
  .x-popover {
2
- position: relative;
3
- display: inline-block;
4
- }
2
+ transition-property: var(--default-transition-property);
3
+ transition-timing-function: var(--ease-in-out);
4
+ transition-duration: var(--default-transition-duration);
5
+ transition-behavior: allow-discrete;
6
+ position: fixed;
7
+ inset: auto;
8
+ container-type: anchored;
9
+
10
+ @starting-style {
11
+ opacity: var(--x-popover-starting-opacity);
12
+ }
13
+
14
+ &:not(:popover-open) {
15
+ opacity: var(--x-popover-starting-opacity);
16
+ }
17
+ }
@@ -1,3 +1,5 @@
1
+ @import "./props/default.css";
1
2
  @import "./props/content.css";
2
3
  @import "./default.css";
3
4
  @import "./content.css";
5
+ @import "./tooltip.css";
@@ -1,20 +1,16 @@
1
- import { FlipOptions, Middleware, OffsetOptions, Placement, ShiftOptions } from "@floating-ui/dom";
1
+ import type { ComputePositionConfig } from '@floating-ui/dom'
2
+ import type { Placement } from '@floating-ui/utils'
2
3
 
3
- export interface ShowPopoverOptions {
4
- anchorSelector: string,
5
- openAttribute?: string
6
- compute?: boolean
7
- placement?: Placement
8
- middleware?: Array<Middleware | null | undefined | false>
9
- offset?: OffsetOptions
10
- flip?: FlipOptions
11
- shift?: ShiftOptions
12
- }
4
+ export declare function computePositionPopover(
5
+ referenceElement: HTMLElement,
6
+ floatingElement: HTMLElement & { $currentPlacement?: string },
7
+ placement: Placement,
8
+ options?: ComputePositionConfig | boolean
9
+ ): Promise<void>
13
10
 
14
- export interface HidePopoverOptions {
15
- openAttribute?: string
16
- }
17
-
18
- export function showPopover(element: HTMLElement | Element, options?: ShowPopoverOptions): Promise<void>
19
- export function hidePopover(element: HTMLElement | Element): Promise<void>
20
- export function togglePopover(element: HTMLElement | Element, options?: ShowPopoverOptions): Promise<void>
11
+ export declare function autoUpdatePopover(
12
+ referenceElement: HTMLElement,
13
+ floatingElement: HTMLElement,
14
+ placement: Placement,
15
+ options?: ComputePositionConfig | boolean
16
+ ): Promise<() => void>
@@ -1,93 +1,53 @@
1
- import { animationsFinished, nextRepaint } from '../../common.js'
1
+ import { supportsAnchor } from '../../common.js'
2
2
 
3
3
  /**
4
- * @param {HTMLElement | Element} element
5
- * @param {HTMLElement | Element} popoverElement
6
- * @param {import("./").ShowPopoverOptions} options
7
- * @returns Promise<void>
4
+ * @param {HTMLElement} referenceElement
5
+ * @param {HTMLElement & { _currentPlacement?: import('@floating-ui/utils').Placement }} floatingElement
6
+ * @param {import('@floating-ui/utils').Placement} placement
7
+ * @param {import('@floating-ui/dom').ComputePositionConfig | boolean} [options={}]
8
+ * @returns {Promise<void>}
8
9
  */
9
- export const computePopover = async (element, popoverElement, options = {}) => {
10
- const { computePosition, flip, shift, offset } = await import('@floating-ui/dom')
11
-
12
- popoverElement.classList.remove(popoverElement._placement)
13
-
14
- await computePosition(element, popoverElement, {
15
- placement: options?.placement,
16
- middleware: options?.middleware ?? [offset(options?.offset ?? 12), flip(options?.flip), shift({ padding: 8, ...options?.shift })],
10
+ export const computePositionPopover = async (
11
+ referenceElement,
12
+ floatingElement,
13
+ placement,
14
+ options = {},
15
+ ) => {
16
+ const { computePosition, flip } = await import('@floating-ui/dom')
17
+
18
+ const autoUpdate = options === true
19
+ const middleware = autoUpdate ? [flip()] : []
20
+
21
+ floatingElement.classList.remove(floatingElement._currentPlacement ?? placement)
22
+ floatingElement.style.setProperty('--anchor-size', !supportsAnchor ? `${referenceElement.offsetWidth}px` : '')
23
+
24
+ await computePosition(referenceElement, floatingElement, {
25
+ middleware,
26
+ placement,
27
+ ...(autoUpdate ? {} : options),
17
28
  }).then(({ x, y, placement }) => {
18
- Object.assign(popoverElement.style, {
19
- inset: `${y}px auto auto ${x}px`,
20
- })
21
-
22
- popoverElement._placement = placement
23
- popoverElement.classList.add(popoverElement._placement)
29
+ floatingElement.style.inset = !supportsAnchor ? `${y}px auto auto ${x}px` : ''
30
+ floatingElement.classList.add(placement)
31
+ floatingElement._currentPlacement = placement
24
32
  })
25
33
  }
26
34
 
27
35
  /**
28
- * @param {HTMLElement | Element} element - The HTML content to insert into the dialog.
29
- * @param {import("./").HidePopoverOptions} options
30
- * @returns Promise<void>
36
+ * @param {HTMLElement} referenceElement
37
+ * @param {HTMLElement} floatingElement
38
+ * @param {import('@floating-ui/utils').Placement} placement
39
+ * @param {import('@floating-ui/dom').ComputePositionConfig | boolean} [options={}]
40
+ * @returns {Promise<() => void>}
31
41
  */
32
- export const hidePopover = async (element, options = { openAttribute: 'data-open' }) => {
33
- const popoverElement = document.getElementById(element.getAttribute('popovertarget'))
34
-
35
- popoverElement.removeAttribute(options?.openAttribute)
36
- await animationsFinished(popoverElement)
37
- popoverElement._cleanup && popoverElement._cleanup()
38
- popoverElement.hidePopover && popoverElement.hidePopover()
39
-
40
- element.ariaExpanded = 'false'
41
- }
42
-
43
- /**
44
- * @param {HTMLElement | Element} element
45
- * @param {import("./").ShowPopoverOptions} options
46
- * @returns Promise<void>
47
- */
48
- export const showPopover = async (element, options) => {
49
- options = {
50
- openAttribute: 'data-open',
51
- compute: true,
52
- ...options,
53
- }
54
-
42
+ export const autoUpdatePopover = async (
43
+ referenceElement,
44
+ floatingElement,
45
+ placement,
46
+ options = {},
47
+ ) => {
55
48
  const { autoUpdate } = await import('@floating-ui/dom')
56
49
 
57
- const popoverElement = document.getElementById(element.getAttribute('popovertarget'))
58
-
59
- element.ariaExpanded = 'true'
60
-
61
- if (!element.ariaHasPopup) (element.ariaHasPopup = 'dialog')
62
- if (!popoverElement.role) (popoverElement.role = element.ariaHasPopup)
63
-
64
- popoverElement.showPopover && popoverElement.showPopover()
65
-
66
- await nextRepaint()
67
-
68
- popoverElement.setAttribute(options?.openAttribute, '')
69
-
70
- if (!options.compute) {
71
- return
72
- }
73
-
74
- popoverElement._cleanup = autoUpdate(
75
- element,
76
- popoverElement,
77
- async () => await computePopover(options.anchorSelector ? document.querySelector(options.anchorSelector) : element, popoverElement, options),
50
+ return autoUpdate(referenceElement, floatingElement, () =>
51
+ computePositionPopover(referenceElement, floatingElement, placement, options),
78
52
  )
79
53
  }
80
-
81
- /**
82
- * @param {HTMLElement | Element} element
83
- * @param {import("./").ShowPopoverOptions} options
84
- * @returns Promise<void>
85
- */
86
- export const togglePopover = async (element, options) => {
87
- if (element.ariaExpanded !== 'true') {
88
- await showPopover(element, options)
89
- }
90
- else {
91
- await hidePopover(element)
92
- }
93
- }
@@ -4,6 +4,5 @@
4
4
  --x-popover-content-border-radius: var(--radius-xl);
5
5
  --x-popover-content-padding-block: calc(var(--spacing) * 2);
6
6
  --x-popover-content-padding-inline: calc(var(--spacing) * 2);
7
- --x-popover-content-scale-y: 0.75;
8
- --x-popover-content-scale-x: 0.75;
7
+ --x-popover-content-starting-scale: 0.75;
9
8
  }
@@ -0,0 +1,4 @@
1
+ :root,
2
+ :host {
3
+ --x-popover-starting-opacity: 0;
4
+ }
@@ -14,9 +14,8 @@ Include CSS either globally or to your component _([you can't use TailwindCSS la
14
14
  or modular (you can use your own props or CSS)
15
15
 
16
16
  ```css
17
- @import "winduum/src/components/popover/props/content.css" layer(components);
17
+ @import "winduum/src/components/popover/props/default.css" layer(components);
18
18
  @import "winduum/src/components/popover/default.css" layer(components);
19
- @import "winduum/src/components/popover/content.css" layer(components);
20
19
  ```
21
20
 
22
21
  ### Local imports
@@ -0,0 +1,11 @@
1
+ .x-popover {
2
+ &:is(.tooltip) {
3
+ --x-popover-content-background-color: var(--color-main);
4
+ --x-popover-content-color: var(--color-main-foreground);
5
+ --x-popover-content-border-radius: var(--radius-md);
6
+ --x-popover-content-padding-block: calc(var(--spacing) * 1);
7
+ --x-popover-content-padding-inline: calc(var(--spacing) * 2);
8
+ --x-popover-font-size: var(--text-sm);
9
+ --x-popover-content-starting-scale: 0.75;
10
+ }
11
+ }
@@ -1,6 +1,6 @@
1
1
  interface ToggleTabOptions {
2
- tabElements?: NodeListOf<Element>
3
- tabPanelElements?: NodeListOf<Element>
2
+ tabElements?: NodeListOf<Element> | Element[]
3
+ tabPanelElements?: NodeListOf<Element> | Element[]
4
4
  }
5
5
 
6
6
  export function toggleTab(element: HTMLElement | Element, options?: ToggleTabOptions): void