winduum 2.2.9 → 2.2.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 (99) hide show
  1. package/package.json +13 -14
  2. package/plugin/index.cjs +219 -217
  3. package/plugin/index.js +94 -94
  4. package/plugin/utilities/color.js +52 -50
  5. package/plugin/utilities/common.js +60 -60
  6. package/plugin/utilities/divide-gap.js +19 -19
  7. package/plugin/utilities/dot.js +10 -10
  8. package/src/base/defaults.css +1 -1
  9. package/src/base/reset.css +4 -1
  10. package/src/common.js +6 -6
  11. package/src/components/badge/props/default.css +2 -1
  12. package/src/components/breadcrumb/default.css +2 -1
  13. package/src/components/breadcrumb/props/default.css +2 -1
  14. package/src/components/button/interactive.css +3 -1
  15. package/src/components/button/props/default.css +2 -1
  16. package/src/components/button/props/interactive.css +2 -1
  17. package/src/components/card/props/default.css +2 -1
  18. package/src/components/carousel/content.css +2 -1
  19. package/src/components/carousel/index.js +128 -126
  20. package/src/components/check/default.css +1 -1
  21. package/src/components/check/props/default.css +4 -3
  22. package/src/components/color/default.css +2 -1
  23. package/src/components/color/interactive.css +2 -1
  24. package/src/components/color/props/default.css +3 -2
  25. package/src/components/compare/default.css +2 -1
  26. package/src/components/compare/index.js +9 -9
  27. package/src/components/control/icon.css +4 -2
  28. package/src/components/control/interactive.css +2 -1
  29. package/src/components/control/props/color.css +2 -1
  30. package/src/components/control/props/default.css +5 -4
  31. package/src/components/control/props/floating.css +2 -1
  32. package/src/components/control/props/icon.css +2 -1
  33. package/src/components/control/props/select-picker.css +4 -3
  34. package/src/components/control/props/select.css +2 -1
  35. package/src/components/control/select-picker.css +4 -2
  36. package/src/components/control/select.css +1 -1
  37. package/src/components/details/index.js +39 -38
  38. package/src/components/dialog/default.css +2 -1
  39. package/src/components/dialog/index.d.ts +1 -1
  40. package/src/components/dialog/index.js +42 -40
  41. package/src/components/dialog/props/content.css +2 -1
  42. package/src/components/dialog/props/default.css +2 -1
  43. package/src/components/drawer/default.css +2 -1
  44. package/src/components/drawer/index.js +29 -29
  45. package/src/components/drawer/props/content.css +2 -1
  46. package/src/components/drawer/props/default.css +2 -1
  47. package/src/components/form/index.js +83 -80
  48. package/src/components/heading/props/default.css +2 -1
  49. package/src/components/info/props/default.css +2 -1
  50. package/src/components/label/props/default.css +2 -1
  51. package/src/components/link/props/default.css +2 -1
  52. package/src/components/notice/props/default.css +2 -1
  53. package/src/components/popover/content.css +4 -2
  54. package/src/components/popover/index.js +45 -44
  55. package/src/components/popover/props/content.css +2 -1
  56. package/src/components/progress/props/default.css +2 -1
  57. package/src/components/range/index.js +37 -37
  58. package/src/components/range/props/default.css +2 -1
  59. package/src/components/rating/default.css +1 -1
  60. package/src/components/rating/props/default.css +2 -1
  61. package/src/components/switch/props/default.css +4 -3
  62. package/src/components/table/interactive.css +10 -5
  63. package/src/components/table/props/default.css +2 -1
  64. package/src/components/tabs/index.js +5 -5
  65. package/src/components/text/props/default.css +2 -1
  66. package/src/components/title/props/default.css +2 -1
  67. package/src/components/toast/index.js +25 -25
  68. package/src/components/toast/props/content.css +2 -1
  69. package/src/components/toast/props/default.css +2 -1
  70. package/src/components/toaster/index.js +3 -3
  71. package/src/components/toaster/props/default.css +2 -1
  72. package/src/components/tooltip/default.css +4 -2
  73. package/src/components/tooltip/props/default.css +2 -1
  74. package/src/theme/config/font.css +2 -1
  75. package/src/theme/config/radius.css +2 -1
  76. package/src/theme/config/spacing.css +2 -1
  77. package/src/theme/config/transition.css +2 -1
  78. package/src/theme/config/z.css +2 -1
  79. package/src/theme/dark-rgb.css +2 -1
  80. package/src/theme/dark.css +2 -1
  81. package/src/theme/default-p3.css +2 -1
  82. package/src/theme/default-rgb.css +3 -2
  83. package/src/theme/default.css +3 -2
  84. package/src/utilities/container/props/default.css +2 -1
  85. package/src/utilities/divider.css +5 -3
  86. package/src/utilities/dot.css +1 -1
  87. package/src/utilities/ripple/index.js +13 -13
  88. package/src/utilities/skeleton/props/default.css +2 -1
  89. package/src/utilities/spinner/default.css +4 -4
  90. package/src/utilities/spinner/ring.css +1 -1
  91. package/src/utilities/swap/index.js +4 -4
  92. package/tailwind.config.js +16 -17
  93. package/tailwindcss/base/defaults.css +3 -2
  94. package/tailwindcss/theme/config/transition.css +2 -1
  95. package/tailwindcss/theme/default.css +1 -1
  96. package/tailwindcss/utilities/divider.css +4 -2
  97. package/tailwindcss/utilities/dot.css +1 -1
  98. package/tailwindcss/utilities/spinner.css +5 -5
  99. package/types/index.d.ts +1 -1
@@ -2,8 +2,8 @@
2
2
  * @type {import("./").DefaultOptions}
3
3
  */
4
4
  export const defaultOptions = {
5
- selector: 'details',
6
- summarySelector: 'summary'
5
+ selector: 'details',
6
+ summarySelector: 'summary',
7
7
  }
8
8
 
9
9
  /**
@@ -12,21 +12,21 @@ export const defaultOptions = {
12
12
  * @returns Promise<void>
13
13
  */
14
14
  export const showDetails = async (element, options = {}) => {
15
- options = {
16
- ...defaultOptions,
17
- ...options
18
- }
15
+ options = {
16
+ ...defaultOptions,
17
+ ...options,
18
+ }
19
19
 
20
- const details = element.closest(options.selector)
21
- const { down } = await import('slide-element')
22
- const content = details.querySelector(options.summarySelector).nextElementSibling
20
+ const details = element.closest(options.selector)
21
+ const { down } = await import('slide-element')
22
+ const content = details.querySelector(options.summarySelector).nextElementSibling
23
23
 
24
- details._isHiding = false
25
- details.open = true
24
+ details._isHiding = false
25
+ details.open = true
26
26
 
27
- await down(content, {
28
- display: ''
29
- })
27
+ await down(content, {
28
+ display: '',
29
+ })
30
30
  }
31
31
 
32
32
  /**
@@ -35,23 +35,23 @@ export const showDetails = async (element, options = {}) => {
35
35
  * @returns Promise<void>
36
36
  */
37
37
  export const closeDetails = async (element, options = {}) => {
38
- options = {
39
- ...defaultOptions,
40
- ...options
41
- }
38
+ options = {
39
+ ...defaultOptions,
40
+ ...options,
41
+ }
42
42
 
43
- const details = element.closest(options.selector)
44
- const { up } = await import('slide-element')
45
- const content = details.querySelector(options.summarySelector).nextElementSibling
43
+ const details = element.closest(options.selector)
44
+ const { up } = await import('slide-element')
45
+ const content = details.querySelector(options.summarySelector).nextElementSibling
46
46
 
47
- details._isHiding = true
47
+ details._isHiding = true
48
48
 
49
- await up(content, {
50
- display: ''
51
- })
49
+ await up(content, {
50
+ display: '',
51
+ })
52
52
 
53
- details._isHiding && (details.open = false)
54
- details._isHiding = false
53
+ details._isHiding && (details.open = false)
54
+ details._isHiding = false
55
55
  }
56
56
 
57
57
  /**
@@ -60,18 +60,19 @@ export const closeDetails = async (element, options = {}) => {
60
60
  * @returns Promise<void>
61
61
  */
62
62
  export const toggleDetails = async (element, options = {}) => {
63
- options = {
64
- ...defaultOptions,
65
- ...options
66
- }
63
+ options = {
64
+ ...defaultOptions,
65
+ ...options,
66
+ }
67
67
 
68
- const details = element.closest(options.selector)
68
+ const details = element.closest(options.selector)
69
69
 
70
- if (details._isHiding && !element.checked) return
70
+ if (details._isHiding && !element.checked) return
71
71
 
72
- if (element.checked ?? !details.open) {
73
- await showDetails(element, options)
74
- } else {
75
- await closeDetails(element, options)
76
- }
72
+ if (element.checked ?? !details.open) {
73
+ await showDetails(element, options)
74
+ }
75
+ else {
76
+ await closeDetails(element, options)
77
+ }
77
78
  }
@@ -15,7 +15,8 @@
15
15
  overscroll-behavior: contain;
16
16
  -webkit-overflow-scrolling: touch;
17
17
 
18
- &::backdrop, &:not([open]) {
18
+ &::backdrop,
19
+ &:not([open]) {
19
20
  display: none;
20
21
  }
21
22
 
@@ -5,7 +5,7 @@ export interface DefaultOptions {
5
5
  openAttribute?: string
6
6
  closedAttribute?: string
7
7
  contentSelector?: string
8
- scrollbarWidthProperty?: string
8
+ scrollbarWidthProperty?: string | null
9
9
  }
10
10
 
11
11
  export const defaultOptions: DefaultOptions
@@ -4,12 +4,12 @@ import { animationsFinished, nextRepaint } from '../../common.js'
4
4
  * @type {import("./").DefaultOptions}
5
5
  */
6
6
  export const defaultOptions = {
7
- closedAttribute: 'data-closed',
8
- openAttribute: 'data-open',
9
- scrollbarWidthProperty: '--default-scrollbar-width',
10
- contentSelector: '.x-dialog-content',
11
- closable: true,
12
- modal: true
7
+ closedAttribute: 'data-closed',
8
+ openAttribute: 'data-open',
9
+ scrollbarWidthProperty: '--default-scrollbar-width',
10
+ contentSelector: '.x-dialog-content',
11
+ closable: true,
12
+ modal: true,
13
13
  }
14
14
 
15
15
  /**
@@ -19,38 +19,40 @@ export const defaultOptions = {
19
19
  * @returns Promise<void>
20
20
  */
21
21
  export const showDialog = async (element, options = {}) => {
22
- options = {
23
- ...defaultOptions,
24
- ...options
25
- }
22
+ options = {
23
+ ...defaultOptions,
24
+ ...options,
25
+ }
26
26
 
27
+ if (options.scrollbarWidthProperty) {
27
28
  document.documentElement.style.setProperty(options.scrollbarWidthProperty, `${window.innerWidth - document.body.clientWidth}px`)
29
+ }
28
30
 
29
- if (!element?._dialogHasEvents) {
30
- element.addEventListener('cancel', (e) => {
31
- e.preventDefault()
32
- options.closable && closeDialog(element, options)
33
- })
31
+ if (!element?._dialogHasEvents) {
32
+ element.addEventListener('cancel', (e) => {
33
+ e.preventDefault()
34
+ options.closable && closeDialog(element, options)
35
+ })
34
36
 
35
- element.addEventListener('click', ({ target }) => {
36
- if (target.nodeName === 'DIALOG' && options.closable) {
37
- closeDialog(element, options)
38
- }
39
- })
37
+ element.addEventListener('click', ({ target }) => {
38
+ if (target.nodeName === 'DIALOG' && options.closable) {
39
+ closeDialog(element, options)
40
+ }
41
+ })
40
42
 
41
- element._dialogHasEvents = true
42
- }
43
+ element._dialogHasEvents = true
44
+ }
43
45
 
44
- element.setAttribute(options.closedAttribute, '')
46
+ element.setAttribute(options.closedAttribute, '')
45
47
 
46
- options.modal ? element.showModal() : element.show()
47
- element.scroll(0, 0)
48
+ options.modal ? element.showModal() : element.show()
49
+ element.scroll(0, 0)
48
50
 
49
- element.removeAttribute(options.closedAttribute)
50
- await animationsFinished(element.querySelector(options.contentSelector))
51
- element.setAttribute(options.openAttribute, '')
51
+ element.removeAttribute(options.closedAttribute)
52
+ await animationsFinished(element.querySelector(options.contentSelector))
53
+ element.setAttribute(options.openAttribute, '')
52
54
 
53
- element.dispatchEvent(new CustomEvent('x-dialog:show'))
55
+ element.dispatchEvent(new CustomEvent('x-dialog:show'))
54
56
  }
55
57
 
56
58
  /**
@@ -60,21 +62,21 @@ export const showDialog = async (element, options = {}) => {
60
62
  * @returns Promise<void>
61
63
  */
62
64
  export const closeDialog = async (element, options = {}) => {
63
- options = {
64
- ...defaultOptions,
65
- ...options
66
- }
65
+ options = {
66
+ ...defaultOptions,
67
+ ...options,
68
+ }
67
69
 
68
- element.dispatchEvent(new CustomEvent('x-dialog:close'))
70
+ element.dispatchEvent(new CustomEvent('x-dialog:close'))
69
71
 
70
- element.removeAttribute(options.openAttribute)
71
- element.setAttribute(options.closedAttribute, '')
72
+ element.removeAttribute(options.openAttribute)
73
+ element.setAttribute(options.closedAttribute, '')
72
74
 
73
- await animationsFinished(element.querySelector(options.contentSelector))
75
+ await animationsFinished(element.querySelector(options.contentSelector))
74
76
 
75
- element.close()
77
+ element.close()
76
78
 
77
- await nextRepaint()
79
+ await nextRepaint()
78
80
 
79
- options.remove && element.remove()
81
+ options.remove && element.remove()
80
82
  }
@@ -1,4 +1,5 @@
1
- :root, :host {
1
+ :root,
2
+ :host {
2
3
  --x-dialog-content-padding-block: 2rem;
3
4
  --x-dialog-content-padding-inline: 1.5rem;
4
5
  --x-dialog-content-inline-size: 35rem;
@@ -1,4 +1,5 @@
1
- :root, :host {
1
+ :root,
2
+ :host {
2
3
  --x-dialog-padding-block: 2rem;
3
4
  --x-dialog-padding-inline: 1.5rem;
4
5
  --x-dialog-background-color: var(--color-dark);
@@ -15,7 +15,8 @@
15
15
  -webkit-overflow-scrolling: touch;
16
16
  overscroll-behavior: contain;
17
17
 
18
- &:not([open]), &::backdrop {
18
+ &:not([open]),
19
+ &::backdrop {
19
20
  display: none;
20
21
  }
21
22
 
@@ -7,7 +7,7 @@ import { nextRepaint } from '../../common.js'
7
7
  * @returns void
8
8
  */
9
9
  export const showDrawer = async (element, distance = 0, direction = 'left') => {
10
- element.scroll({ [direction]: distance })
10
+ element.scroll({ [direction]: distance })
11
11
  }
12
12
 
13
13
  /**
@@ -17,7 +17,7 @@ export const showDrawer = async (element, distance = 0, direction = 'left') => {
17
17
  * @returns void
18
18
  */
19
19
  export const closeDrawer = (element, distance = element.scrollWidth, direction = 'left') => {
20
- element.scroll({ [direction]: distance })
20
+ element.scroll({ [direction]: distance })
21
21
  }
22
22
 
23
23
  /**
@@ -27,8 +27,8 @@ export const closeDrawer = (element, distance = element.scrollWidth, direction =
27
27
  * @returns void
28
28
  */
29
29
  export const scrollInitDrawer = async (element, distance = element.scrollWidth, direction = 'left') => {
30
- element.scroll({ [direction]: distance, behavior: 'instant' })
31
- await nextRepaint()
30
+ element.scroll({ [direction]: distance, behavior: 'instant' })
31
+ await nextRepaint()
32
32
  }
33
33
 
34
34
  /**
@@ -38,9 +38,9 @@ export const scrollInitDrawer = async (element, distance = element.scrollWidth,
38
38
  * @returns void
39
39
  */
40
40
  export const toggleDrawerAttributes = (element, state = 'open', snapClass) => {
41
- element.classList[state === 'open' ? 'add' : 'remove'](...snapClass.split(/\s/))
42
- element.inert = state === 'close'
43
- element.dispatchEvent(new CustomEvent(`x-drawer:${state}`))
41
+ element.classList[state === 'open' ? 'add' : 'remove'](...snapClass.split(/\s/))
42
+ element.inert = state === 'close'
43
+ element.dispatchEvent(new CustomEvent(`x-drawer:${state}`))
44
44
  }
45
45
 
46
46
  /**
@@ -49,7 +49,7 @@ export const toggleDrawerAttributes = (element, state = 'open', snapClass) => {
49
49
  * @returns boolean
50
50
  */
51
51
  export const scrollDrawerState = (scrollState, scrollDirection) => {
52
- return scrollState ? Math.ceil(scrollDirection) >= scrollState : Math.floor(scrollDirection) <= scrollState
52
+ return scrollState ? Math.ceil(scrollDirection) >= scrollState : Math.floor(scrollDirection) <= scrollState
53
53
  }
54
54
 
55
55
  /**
@@ -58,28 +58,28 @@ export const scrollDrawerState = (scrollState, scrollDirection) => {
58
58
  * @returns void
59
59
  */
60
60
  export const scrollDrawer = (element, options = {}) => {
61
- options = {
62
- snapClass: 'snap-x snap-mandatory',
63
- opacityProperty: '--background-color-opacity',
64
- opacityRatio: 1,
65
- scrollOpen: 0,
66
- scrollClose: element.scrollWidth - element.clientWidth,
67
- scrollSize: element.scrollWidth - element.clientWidth,
68
- scrollDirection: element.scrollLeft,
69
- ...options
70
- }
61
+ options = {
62
+ snapClass: 'snap-x snap-mandatory',
63
+ opacityProperty: '--background-color-opacity',
64
+ opacityRatio: 1,
65
+ scrollOpen: 0,
66
+ scrollClose: element.scrollWidth - element.clientWidth,
67
+ scrollSize: element.scrollWidth - element.clientWidth,
68
+ scrollDirection: element.scrollLeft,
69
+ ...options,
70
+ }
71
71
 
72
- element.style.setProperty(
73
- options.opacityProperty,
74
- `${Math.min(Math.abs((options.scrollDirection / options.scrollSize) - options.opacityRatio), 1)}`
75
- )
72
+ element.style.setProperty(
73
+ options.opacityProperty,
74
+ `${Math.min(Math.abs((options.scrollDirection / options.scrollSize) - options.opacityRatio), 1)}`,
75
+ )
76
76
 
77
- if (scrollDrawerState(options.scrollOpen, options.scrollDirection)) {
78
- toggleDrawerAttributes(element, 'open', options.snapClass)
79
- }
77
+ if (scrollDrawerState(options.scrollOpen, options.scrollDirection)) {
78
+ toggleDrawerAttributes(element, 'open', options.snapClass)
79
+ }
80
80
 
81
- if (scrollDrawerState(options.scrollClose, options.scrollDirection) && !element.inert) {
82
- toggleDrawerAttributes(element, 'close', options.snapClass)
83
- element.close && element.close()
84
- }
81
+ if (scrollDrawerState(options.scrollClose, options.scrollDirection) && !element.inert) {
82
+ toggleDrawerAttributes(element, 'close', options.snapClass)
83
+ element.close && element.close()
84
+ }
85
85
  }
@@ -1,4 +1,5 @@
1
- :root, :host {
1
+ :root,
2
+ :host {
2
3
  --x-drawer-content-background-color: var(--color-body-primary);
3
4
  --x-drawer-content-padding-block: 2rem;
4
5
  --x-drawer-content-padding-inline: 1.5rem;
@@ -1,3 +1,4 @@
1
- :root, :host {
1
+ :root,
2
+ :host {
2
3
  --x-drawer-background-color-opacity: 75%;
3
4
  }
@@ -4,32 +4,33 @@
4
4
  * @returns void
5
5
  */
6
6
  export const validateForm = (event, options = {}) => {
7
- options = {
8
- validateSelectors: '.x-control, .x-check, .x-switch, .x-rating, .x-color',
9
- validateOptions: {
10
- validate: true
11
- },
12
- validateField,
13
- submitterLoadingAttribute: 'data-loading',
14
- scrollOptions: { behavior: 'smooth', block: 'center' },
15
- ...options
7
+ options = {
8
+ validateSelectors: '.x-control, .x-check, .x-switch, .x-rating, .x-color',
9
+ validateOptions: {
10
+ validate: true,
11
+ },
12
+ validateField,
13
+ submitterLoadingAttribute: 'data-loading',
14
+ scrollOptions: { behavior: 'smooth', block: 'center' },
15
+ ...options,
16
+ }
17
+
18
+ if (options.validateOptions.validate) {
19
+ if (!event.target.checkValidity()) {
20
+ event.preventDefault()
21
+ event.stopImmediatePropagation()
22
+
23
+ event.target.querySelector(':invalid').scrollIntoView(options.scrollOptions)
24
+ event.target.querySelector(':invalid').focus()
16
25
  }
17
-
18
- if (options.validateOptions.validate) {
19
- if (!event.target.checkValidity()) {
20
- event.preventDefault()
21
- event.stopImmediatePropagation()
22
-
23
- event.target.querySelector(':invalid').scrollIntoView(options.scrollOptions)
24
- event.target.querySelector(':invalid').focus()
25
- } else {
26
- event?.submitter?.setAttribute(options.submitterLoadingAttribute, '')
27
- }
26
+ else {
27
+ event?.submitter?.setAttribute(options.submitterLoadingAttribute, '')
28
28
  }
29
+ }
29
30
 
30
- event.target.querySelectorAll(options.validateSelectors).forEach((element) => {
31
- options.validateField(element, options.validateOptions)
32
- })
31
+ event.target.querySelectorAll(options.validateSelectors).forEach((element) => {
32
+ options.validateField(element, options.validateOptions)
33
+ })
33
34
  }
34
35
 
35
36
  /**
@@ -38,75 +39,77 @@ export const validateForm = (event, options = {}) => {
38
39
  * @returns void
39
40
  */
40
41
  export const validateField = (element, options = {}) => {
41
- options = {
42
- validate: true,
43
- selector: 'input:not([type="hidden"]), textarea, select',
44
- ignoreMatch: /(data-novalidate|readonly)/,
45
- validitySelector: '.validity',
46
- infoParentSelector: '.x-field',
47
- infoSelector: '.x-info',
48
- infoContent: '<div class="x-info text-error validity"></div>',
49
- endParentSelector: '.x-control',
50
- endSelector: '.ms-auto',
51
- endContent: '<div class="ms-auto"></div>',
52
- validAttribute: 'data-valid',
53
- validIcon: null,
54
- invalidAttribute: 'data-invalid',
55
- invalidIcon: '<svg class="text-error validity" aria-hidden="true"><use href="#icon-exclamation-circle"></use></svg>',
56
- activeAttribute: 'data-active',
57
- ...options
42
+ 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',
54
+ 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',
58
+ ...options,
59
+ }
60
+
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)
58
75
  }
59
76
 
60
- if (!element.querySelector(options.selector)) return
77
+ element.querySelector(options.endSelector).insertAdjacentHTML('afterbegin', icon)
78
+ }
61
79
 
62
- const validationElement = element.querySelector(options.selector)
63
- const validationMessage = options.validationMessage ?? validationElement.dataset.validationMessage ?? validationElement.validationMessage
64
- const infoParentElement = validationElement?.closest(options.infoParentSelector)
65
- const endParentElement = validationElement.closest(options.endParentSelector)
66
- const infoSelector = options.infoSelector + options.validitySelector
67
- const endSelector = `${options.endSelector} ${options.validitySelector}`
80
+ if (validationElement.value !== '') {
81
+ element.setAttribute(options.activeAttribute, '')
82
+ }
83
+ else {
84
+ element.removeAttribute(options.activeAttribute)
85
+ }
68
86
 
69
- const insertIcon = (icon) => {
70
- if (!endParentElement || !icon) return
87
+ if (!validationElement.outerHTML.match(options.ignoreMatch) && options.validate) {
88
+ element?.removeAttribute(options.validAttribute)
89
+ element?.removeAttribute(options.invalidAttribute)
71
90
 
72
- if (!element?.querySelector(options.endSelector)) {
73
- element?.insertAdjacentHTML('beforeend', options.endContent)
74
- }
91
+ infoParentElement?.querySelector(infoSelector)?.remove()
92
+ endParentElement?.querySelector(endSelector)?.remove()
75
93
 
76
- element.querySelector(options.endSelector).insertAdjacentHTML('afterbegin', icon)
77
- }
94
+ if (validationElement.checkValidity()) {
95
+ element.setAttribute(options.validAttribute, '')
78
96
 
79
- if (validationElement.value !== '') {
80
- element.setAttribute(options.activeAttribute, '')
81
- } else {
82
- element.removeAttribute(options.activeAttribute)
97
+ insertIcon(options.validIcon)
83
98
  }
99
+ else {
100
+ element.setAttribute(options.invalidAttribute, '')
84
101
 
85
- if (!validationElement.outerHTML.match(options.ignoreMatch) && options.validate) {
86
- element?.removeAttribute(options.validAttribute)
87
- element?.removeAttribute(options.invalidAttribute)
88
-
89
- infoParentElement?.querySelector(infoSelector)?.remove()
90
- endParentElement?.querySelector(endSelector)?.remove()
91
-
92
- if (validationElement.checkValidity()) {
93
- element.setAttribute(options.validAttribute, '')
94
-
95
- insertIcon(options.validIcon)
96
- } else {
97
- element.setAttribute(options.invalidAttribute, '')
98
-
99
- insertIcon(options.invalidIcon)
102
+ insertIcon(options.invalidIcon)
100
103
 
101
- if (infoParentElement) {
102
- infoParentElement.insertAdjacentHTML('beforeend', options.infoContent)
103
- infoParentElement.querySelector(infoSelector).textContent = validationMessage
104
- }
105
- }
104
+ if (infoParentElement) {
105
+ infoParentElement.insertAdjacentHTML('beforeend', options.infoContent)
106
+ infoParentElement.querySelector(infoSelector).textContent = validationMessage
107
+ }
106
108
  }
109
+ }
107
110
  }
108
111
 
109
112
  export default {
110
- validateForm,
111
- validateField
113
+ validateForm,
114
+ validateField,
112
115
  }
@@ -1,4 +1,5 @@
1
- :root, :host {
1
+ :root,
2
+ :host {
2
3
  --x-heading-font-family: var(--font-primary);
3
4
  --x-heading-font-weight: var(--font-weight-semibold);
4
5
  --x-heading-font-size: var(--text-xl);
@@ -1,4 +1,5 @@
1
- :root, :host {
1
+ :root,
2
+ :host {
2
3
  --x-info-font-size: var(--text-xs);
3
4
  --x-info-line-height: calc(1em + 0.25rem);
4
5
  }
@@ -1,4 +1,5 @@
1
- :root, :host {
1
+ :root,
2
+ :host {
2
3
  --x-label-font-size: var(--text-sm);
3
4
  --x-label-line-height: calc(1em + 0.25rem);
4
5
  }
@@ -1,4 +1,5 @@
1
- :root, :host {
1
+ :root,
2
+ :host {
2
3
  --x-link-font-size: var(--text-sm);
3
4
  --x-link-line-height: calc(1em + 0.25rem);
4
5
  }
@@ -1,4 +1,5 @@
1
- :root, :host {
1
+ :root,
2
+ :host {
2
3
  --x-notice-padding-block: 1.25rem;
3
4
  --x-notice-padding-inline: 1.5rem;
4
5
  --x-notice-font-size: var(--text-sm);
@@ -13,7 +13,8 @@
13
13
  inline-size: max-content;
14
14
  position: absolute;
15
15
 
16
- &:where(.bottom), & {
16
+ &:where(.bottom),
17
+ & {
17
18
  transform-origin: top;
18
19
  }
19
20
 
@@ -91,7 +92,8 @@
91
92
  }
92
93
 
93
94
  &:not([popover]) {
94
- .trigger-focus:not(:focus, :focus-within) > &, .trigger-hover:not(:hover) > & {
95
+ .trigger-focus:not(:focus, :focus-within) > &,
96
+ .trigger-hover:not(:hover) > & {
95
97
  --tw-scale-x: var(--x-popover-content-scale-x);
96
98
  --tw-scale-y: var(--x-popover-content-scale-y);
97
99