winduum 1.2.1 → 2.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.
- package/dist/main.css +1 -1
- package/dist/tailwind.css +1 -1
- package/package.json +15 -15
- package/plugin/index.cjs +81 -43
- package/plugin/index.js +73 -22
- package/plugin/utilities/common.js +4 -4
- package/plugin/utilities/dot.js +4 -5
- package/src/base/breakpoints.css +10 -10
- package/src/base/config/font.css +22 -9
- package/src/base/config/rounded.css +12 -12
- package/src/base/config/transition.css +14 -14
- package/src/base/config/z.css +5 -5
- package/src/base/config.css +0 -1
- package/src/base/defaults.css +10 -12
- package/src/base/keyframes.css +13 -1
- package/src/base/reset.css +2 -7
- package/src/base/theme/dark-rgb.css +1 -1
- package/src/base/theme/dark.css +1 -1
- package/src/base/theme/default-rgb.css +6 -6
- package/src/base/theme/default.css +6 -6
- package/src/components/badge/bordered.css +6 -0
- package/src/components/badge/circle.css +5 -0
- package/src/components/badge/default.css +42 -0
- package/src/{ui → components}/badge/index.css +1 -1
- package/src/components/badge/lg.css +3 -0
- package/src/components/badge/muted.css +4 -0
- package/src/components/badge/props/default.css +9 -0
- package/src/components/badge/readme.md +37 -0
- package/src/components/badge/sm.css +4 -0
- package/src/components/badge/square.css +4 -0
- package/src/components/breadcrumb/default.css +7 -7
- package/src/components/breadcrumb/index.css +1 -1
- package/src/components/breadcrumb/props/default.css +5 -0
- package/src/components/breadcrumb/readme.md +1 -1
- package/src/components/button/bordered.css +19 -0
- package/src/components/button/circle.css +6 -0
- package/src/components/button/default.css +63 -0
- package/src/components/button/fill.css +6 -0
- package/src/components/button/ghosted.css +14 -0
- package/src/{ui/btn → components/button}/index.css +2 -7
- package/src/components/button/interactive.css +56 -0
- package/src/components/button/lg.css +4 -0
- package/src/components/button/muted.css +14 -0
- package/src/components/button/props/default.css +11 -0
- package/src/components/button/props/interactive.css +9 -0
- package/src/components/button/raised.css +6 -0
- package/src/components/button/readme.md +46 -0
- package/src/components/button/sm.css +4 -0
- package/src/components/button/square.css +5 -0
- package/src/components/card/default.css +4 -6
- package/src/components/card/index.css +1 -1
- package/src/components/card/props/default.css +6 -0
- package/src/components/card/readme.md +1 -1
- package/src/components/carousel/content.css +2 -2
- package/src/components/carousel/default.css +1 -1
- package/src/components/carousel/index.d.ts +3 -3
- package/src/components/carousel/index.js +13 -11
- package/src/components/check/default.css +67 -0
- package/src/{ui/switch → components/check}/index.css +1 -1
- package/src/components/check/interactive.css +56 -0
- package/src/components/check/invalid.css +9 -0
- package/src/components/check/props/default.css +13 -0
- package/src/{ui/color → components/check}/readme.md +8 -9
- package/src/components/color/default.css +36 -0
- package/src/components/color/index.css +3 -0
- package/src/components/color/interactive.css +36 -0
- package/src/components/color/props/default.css +7 -0
- package/src/{ui/title → components/color}/readme.md +7 -8
- package/src/components/compare/default.css +17 -18
- package/src/components/compare/index.js +2 -2
- package/src/components/control/color.css +24 -0
- package/src/components/control/default.css +74 -0
- package/src/components/control/file.css +27 -0
- package/src/components/control/floating-interactive.css +13 -0
- package/src/components/control/floating.css +36 -0
- package/src/components/control/icon.css +32 -0
- package/src/{ui → components}/control/index.css +5 -6
- package/src/components/control/interactive.css +19 -0
- package/src/components/control/invalid.css +10 -0
- package/src/components/control/props/color.css +5 -0
- package/src/components/control/props/default.css +16 -0
- package/src/components/control/props/floating.css +4 -0
- package/src/components/control/props/icon.css +4 -0
- package/src/components/control/props/select.css +4 -0
- package/src/components/control/readme.md +43 -0
- package/src/{ui → components}/control/select-multiple.css +2 -2
- package/src/components/control/select.css +23 -0
- package/src/components/dialog/content.css +7 -7
- package/src/components/dialog/default.css +14 -12
- package/src/components/dialog/index.css +2 -2
- package/src/components/dialog/index.d.ts +4 -19
- package/src/components/dialog/index.js +24 -83
- package/src/components/dialog/props/content.css +5 -0
- package/src/components/dialog/props/default.css +6 -0
- package/src/components/dialog/readme.md +2 -2
- package/src/components/drawer/content.css +4 -4
- package/src/components/drawer/default.css +9 -6
- package/src/components/drawer/index.css +2 -2
- package/src/components/drawer/index.js +3 -3
- package/src/components/drawer/props/content.css +7 -0
- package/src/components/drawer/props/default.css +3 -0
- package/src/components/drawer/readme.md +2 -2
- package/src/components/field/default.css +6 -6
- package/src/components/form/index.js +5 -5
- package/src/components/group/default.css +42 -0
- package/src/{ui → components}/group/readme.md +6 -6
- package/src/{ui → components}/group/vertical.css +2 -2
- package/src/components/heading/default.css +8 -0
- package/src/{ui → components}/heading/index.css +1 -1
- package/src/components/heading/lg.css +3 -0
- package/src/components/heading/props/default.css +6 -0
- package/src/{ui/check → components/heading}/readme.md +8 -9
- package/src/components/heading/sm.css +3 -0
- package/src/{ui → components}/image/avatar.css +3 -3
- package/src/{ui → components}/image/default.css +2 -2
- package/src/{ui/notice → components/image}/readme.md +6 -6
- package/src/components/index.css +18 -0
- package/src/components/info/default.css +8 -0
- package/src/components/info/index.css +2 -0
- package/src/components/info/props/default.css +4 -0
- package/src/{ui/rating → components/info}/readme.md +6 -7
- package/src/components/label/default.css +8 -0
- package/src/components/label/index.css +2 -0
- package/src/components/label/props/default.css +4 -0
- package/src/{ui → components}/label/readme.md +6 -6
- package/src/components/link/default.css +8 -0
- package/src/components/link/index.css +3 -0
- package/src/components/link/interactive.css +9 -0
- package/src/components/link/props/default.css +4 -0
- package/src/{ui → components}/link/readme.md +7 -7
- package/src/components/notice/default.css +21 -0
- package/src/components/notice/index.css +2 -0
- package/src/components/notice/props/default.css +8 -0
- package/src/{ui/image → components/notice}/readme.md +6 -6
- package/src/components/pagination/default.css +2 -2
- package/src/components/popover/content.css +18 -19
- package/src/components/popover/default.css +1 -1
- package/src/components/popover/index.css +1 -1
- package/src/components/popover/index.d.ts +5 -1
- package/src/components/popover/index.js +11 -9
- package/src/components/popover/props/content.css +8 -0
- package/src/components/popover/readme.md +1 -1
- package/src/components/progress/default.css +46 -0
- package/src/{ui → components}/progress/index.css +1 -1
- package/src/components/progress/lg.css +3 -0
- package/src/{ui → components}/progress/meter.css +7 -7
- package/src/components/progress/props/default.css +6 -0
- package/src/components/progress/readme.md +33 -0
- package/src/components/progress/sm.css +3 -0
- package/src/components/range/default.css +99 -0
- package/src/{ui → components}/range/index.css +1 -1
- package/src/{ui → components}/range/index.js +2 -2
- package/src/components/range/multi.css +22 -0
- package/src/components/range/props/default.css +9 -0
- package/src/{ui → components}/range/readme.md +8 -8
- package/src/{ui → components}/range/vertical.css +3 -3
- package/src/{ui → components}/rating/default.css +11 -11
- package/src/{ui → components}/rating/index.css +1 -1
- package/src/components/rating/invalid.css +5 -0
- package/src/components/rating/props/default.css +8 -0
- package/src/components/rating/readme.md +31 -0
- package/src/components/switch/default.css +43 -0
- package/src/{ui/check → components/switch}/index.css +1 -2
- package/src/components/switch/interactive.css +43 -0
- package/src/components/switch/invalid.css +6 -0
- package/src/components/switch/props/default.css +17 -0
- package/src/{ui/progress → components/switch}/readme.md +8 -9
- package/src/components/table/default.css +11 -11
- package/src/components/table/index.css +1 -2
- package/src/components/table/interactive.css +14 -14
- package/src/components/table/props/default.css +8 -0
- package/src/components/table/readme.md +1 -2
- package/src/components/tabs/index.css +1 -1
- package/src/components/tabs/list.css +8 -0
- package/src/components/tabs/readme.md +1 -1
- package/src/components/text/default.css +223 -0
- package/src/components/text/index.css +2 -0
- package/src/components/text/props/default.css +9 -0
- package/src/{ui/info → components/text}/readme.md +6 -6
- package/src/components/title/default.css +8 -0
- package/src/{ui → components}/title/index.css +1 -1
- package/src/components/title/lg.css +3 -0
- package/src/components/title/props/default.css +5 -0
- package/src/{ui/heading → components/title}/readme.md +9 -8
- package/src/components/title/sm.css +3 -0
- package/src/components/toast/content.css +16 -15
- package/src/components/toast/default.css +8 -8
- package/src/components/toast/index.css +2 -2
- package/src/components/toast/props/content.css +7 -0
- package/src/components/toast/props/default.css +4 -0
- package/src/components/toast/readme.md +2 -2
- package/src/components/toaster/default.css +4 -4
- package/src/components/toaster/index.css +1 -1
- package/src/components/toaster/index.js +8 -8
- package/src/components/toaster/props/default.css +4 -0
- package/src/components/toaster/readme.md +1 -1
- package/src/components/tooltip/default.css +15 -15
- package/src/components/tooltip/index.css +1 -1
- package/src/components/tooltip/props/default.css +12 -0
- package/src/components/tooltip/readme.md +2 -2
- package/src/main.css +0 -1
- package/src/test.css +7 -0
- package/src/utilities/common.css +2 -6
- package/src/utilities/container/default.css +3 -4
- package/src/utilities/container/index.css +1 -1
- package/src/utilities/divider.css +13 -4
- package/src/utilities/ripple/index.css +9 -6
- package/src/utilities/skeleton/default.css +8 -1
- package/src/utilities/skeleton/index.css +1 -1
- package/src/utilities/skeleton/props/default.css +5 -0
- package/src/utilities/swap/default.css +6 -6
- package/src/utilities/underline.css +3 -3
- package/types/index.d.ts +39 -24
- package/types/index.d.ts.map +3 -8
- package/plugin/utilities/flex.js +0 -12
- package/src/base/config/text.css +0 -15
- package/src/components/breadcrumb/default-props.css +0 -5
- package/src/components/card/default-props.css +0 -4
- package/src/components/dialog/content-props.css +0 -5
- package/src/components/dialog/default-props.css +0 -6
- package/src/components/drawer/content-props.css +0 -6
- package/src/components/drawer/default-props.css +0 -3
- package/src/components/popover/content-props.css +0 -8
- package/src/components/table/default-props.css +0 -8
- package/src/components/table/interactive-props.css +0 -4
- package/src/components/tabs/default.css +0 -8
- package/src/components/toast/content-props.css +0 -7
- package/src/components/toast/default-props.css +0 -4
- package/src/components/toaster/default-props.css +0 -4
- package/src/components/tooltip/default-props.css +0 -12
- package/src/ui/badge/bordered.css +0 -16
- package/src/ui/badge/circle.css +0 -5
- package/src/ui/badge/default-props.css +0 -8
- package/src/ui/badge/default.css +0 -26
- package/src/ui/badge/lg.css +0 -3
- package/src/ui/badge/muted.css +0 -4
- package/src/ui/badge/readme.md +0 -37
- package/src/ui/badge/sm.css +0 -4
- package/src/ui/badge/square.css +0 -4
- package/src/ui/btn/bordered.css +0 -21
- package/src/ui/btn/circle.css +0 -6
- package/src/ui/btn/default-props.css +0 -10
- package/src/ui/btn/default.css +0 -49
- package/src/ui/btn/fill.css +0 -6
- package/src/ui/btn/ghosted.css +0 -9
- package/src/ui/btn/gradient-bordered.css +0 -24
- package/src/ui/btn/gradient.css +0 -10
- package/src/ui/btn/interactive-props.css +0 -9
- package/src/ui/btn/interactive.css +0 -53
- package/src/ui/btn/lg.css +0 -4
- package/src/ui/btn/loading-props.css +0 -4
- package/src/ui/btn/loading.css +0 -24
- package/src/ui/btn/muted.css +0 -9
- package/src/ui/btn/raised.css +0 -7
- package/src/ui/btn/readme.md +0 -51
- package/src/ui/btn/sm.css +0 -4
- package/src/ui/btn/square.css +0 -5
- package/src/ui/btn/wide.css +0 -3
- package/src/ui/check/default-props.css +0 -13
- package/src/ui/check/default.css +0 -74
- package/src/ui/check/interactive-props.css +0 -3
- package/src/ui/check/interactive.css +0 -50
- package/src/ui/check/invalid.css +0 -8
- package/src/ui/color/default-props.css +0 -11
- package/src/ui/color/default.css +0 -48
- package/src/ui/color/index.css +0 -4
- package/src/ui/color/interactive-props.css +0 -3
- package/src/ui/color/interactive.css +0 -30
- package/src/ui/control/color-props.css +0 -5
- package/src/ui/control/color.css +0 -24
- package/src/ui/control/default-props.css +0 -16
- package/src/ui/control/default.css +0 -77
- package/src/ui/control/file.css +0 -25
- package/src/ui/control/floating-interactive.css +0 -13
- package/src/ui/control/floating-props.css +0 -4
- package/src/ui/control/floating.css +0 -36
- package/src/ui/control/icon-props.css +0 -4
- package/src/ui/control/icon.css +0 -32
- package/src/ui/control/interactive-props.css +0 -3
- package/src/ui/control/interactive.css +0 -19
- package/src/ui/control/invalid.css +0 -10
- package/src/ui/control/readme.md +0 -44
- package/src/ui/control/select-props.css +0 -4
- package/src/ui/control/select.css +0 -23
- package/src/ui/group/default.css +0 -42
- package/src/ui/heading/default-props.css +0 -6
- package/src/ui/heading/default.css +0 -8
- package/src/ui/heading/lg.css +0 -3
- package/src/ui/heading/sm.css +0 -3
- package/src/ui/index.css +0 -18
- package/src/ui/info/default-props.css +0 -4
- package/src/ui/info/default.css +0 -8
- package/src/ui/info/index.css +0 -2
- package/src/ui/label/default-props.css +0 -4
- package/src/ui/label/default.css +0 -8
- package/src/ui/label/index.css +0 -2
- package/src/ui/link/default-props.css +0 -4
- package/src/ui/link/default.css +0 -8
- package/src/ui/link/index.css +0 -4
- package/src/ui/link/interactive-props.css +0 -5
- package/src/ui/link/interactive.css +0 -16
- package/src/ui/notice/default-props.css +0 -8
- package/src/ui/notice/default.css +0 -25
- package/src/ui/notice/index.css +0 -2
- package/src/ui/progress/default-props.css +0 -4
- package/src/ui/progress/default.css +0 -47
- package/src/ui/progress/lg.css +0 -3
- package/src/ui/progress/sm.css +0 -3
- package/src/ui/range/default-props.css +0 -10
- package/src/ui/range/default.css +0 -101
- package/src/ui/range/multi.css +0 -22
- package/src/ui/rating/default-props.css +0 -5
- package/src/ui/rating/invalid.css +0 -5
- package/src/ui/switch/default-props.css +0 -17
- package/src/ui/switch/default.css +0 -46
- package/src/ui/switch/interactive-props.css +0 -3
- package/src/ui/switch/interactive.css +0 -39
- package/src/ui/switch/invalid.css +0 -6
- package/src/ui/switch/readme.md +0 -32
- package/src/ui/text/default-props.css +0 -9
- package/src/ui/text/default.css +0 -193
- package/src/ui/text/index.css +0 -2
- package/src/ui/text/readme.md +0 -30
- package/src/ui/title/default-props.css +0 -5
- package/src/ui/title/default.css +0 -8
- package/src/ui/title/lg.css +0 -3
- package/src/ui/title/sm.css +0 -3
- package/src/utilities/skeleton/default-props.css +0 -5
- /package/src/{ui → components}/group/index.css +0 -0
- /package/src/{ui → components}/image/index.css +0 -0
- /package/src/{ui → components}/range/index.d.ts +0 -0
- /package/src/utilities/container/{default-props.css → props/default.css} +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
.x-control:where(:has(:not([type="color"]) ~ label)) {
|
|
2
|
+
> :where(label) {
|
|
3
|
+
margin-inline: var(--x-control-padding-inline-start, 0) var(--x-control-padding-inline-end, 0);
|
|
4
|
+
transition: var(--transition-transform), var(--transition-color), var(--transition-opacity);
|
|
5
|
+
pointer-events: none;
|
|
6
|
+
transform-origin: 0 50%;
|
|
7
|
+
white-space: nowrap;
|
|
8
|
+
text-overflow: ellipsis;
|
|
9
|
+
overflow: clip;
|
|
10
|
+
will-change: transform;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
> :where(textarea) {
|
|
14
|
+
padding-block-start: calc(var(--x-control-padding-block) + var(--x-control-label-translate-y) * var(--x-control-label-scale));
|
|
15
|
+
|
|
16
|
+
+ :where(label) {
|
|
17
|
+
align-self: start;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
> :where(input, select) {
|
|
22
|
+
padding-block: calc(var(--x-control-padding-block) + var(--x-control-label-translate-y) * var(--x-control-label-scale)) calc(var(--x-control-padding-block) - var(--x-control-label-translate-y) * var(--x-control-label-scale));
|
|
23
|
+
|
|
24
|
+
&::-webkit-calendar-picker-indicator,
|
|
25
|
+
&::-webkit-search-cancel-button,
|
|
26
|
+
&::-webkit-outer-spin-button,
|
|
27
|
+
&::-webkit-inner-spin-button {
|
|
28
|
+
transform: translateY(calc(var(--x-control-label-translate-y) * var(--x-control-label-scale) * -1));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&:where(:has(:required)) :where(label)::after {
|
|
33
|
+
color: var(--x-control-required-color, var(--color-error));
|
|
34
|
+
content: " *";
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.x-control {
|
|
2
|
+
--x-control-start: calc(var(--x-control-icon-count-start, 1) * (var(--x-control-icon-size) + var(--x-control-icon-gap)) - var(--x-control-icon-gap));
|
|
3
|
+
--x-control-end: calc(var(--x-control-icon-count-end, 1) * (var(--x-control-icon-size) + var(--x-control-icon-gap)) - var(--x-control-icon-gap));
|
|
4
|
+
|
|
5
|
+
&:has(textarea) {
|
|
6
|
+
:where(.me-auto), :where(.ms-auto) {
|
|
7
|
+
align-self: start;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&:has(.me-auto) {
|
|
12
|
+
--x-control-padding-inline-start: calc(var(--x-control-start) + var(--x-control-padding-inline));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&:has(.ms-auto) {
|
|
16
|
+
--x-control-padding-inline-end: calc(var(--x-control-end) + var(--x-control-padding-inline));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&:has(.me-auto > *:nth-child(2)) {
|
|
20
|
+
--x-control-icon-count-start: 2;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&:has(.ms-auto > *:nth-child(2)) {
|
|
24
|
+
--x-control-icon-count-end: 2;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
:where(.me-auto), :where(.ms-auto) {
|
|
28
|
+
gap: var(--x-control-icon-gap);
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
@import "default
|
|
1
|
+
@import "props/default.css";
|
|
2
|
+
@import "props/color.css";
|
|
3
|
+
@import "props/icon.css";
|
|
4
|
+
@import "props/floating.css";
|
|
5
|
+
@import "props/select.css";
|
|
2
6
|
@import "default.css";
|
|
3
7
|
@import "interactive.css";
|
|
4
|
-
@import "interactive-props.css";
|
|
5
8
|
@import "invalid.css";
|
|
6
|
-
@import "color-props.css";
|
|
7
9
|
@import "color.css";
|
|
8
10
|
@import "icon.css";
|
|
9
|
-
@import "icon-props.css";
|
|
10
11
|
@import "file.css";
|
|
11
|
-
@import "floating-props.css";
|
|
12
12
|
@import "floating.css";
|
|
13
13
|
@import "floating-interactive.css";
|
|
14
|
-
@import "select-props.css";
|
|
15
14
|
@import "select.css";
|
|
16
15
|
@import "select-multiple.css";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.x-control {
|
|
2
|
+
transition-property: var(--default-transition-property);
|
|
3
|
+
transition-timing-function: var(--transition-timing-function-in-out);
|
|
4
|
+
transition-duration: var(--default-transition-duration);
|
|
5
|
+
|
|
6
|
+
&:focus-within {
|
|
7
|
+
--x-control-border-color: var(--x-control-focus-border-color, var(--color-accent));
|
|
8
|
+
--x-control-border-color-opacity: var(--x-control-focus-border-color-opacity, 100%);
|
|
9
|
+
--x-control-outline-offset: var(--x-control-focus-outline-offset);
|
|
10
|
+
--x-control-outline-color-opacity: var(--x-control-focus-outline-color-opacity, 20%);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&.disabled, &:has(:where(input, textarea, select):disabled) {
|
|
14
|
+
--x-control-background-color: var(--x-control-disabled-background-color, currentColor);
|
|
15
|
+
--x-control-background-color-opacity: var(--x-control-disabled-background-color-opacity, 5%);
|
|
16
|
+
--x-control-border-color: var(--x-control-disabled-border-color, currentColor);
|
|
17
|
+
--x-control-border-color-opacity: var(--x-control-disabled-border-color-opacity);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
.x-control {
|
|
2
|
+
&.invalid, &:has(:user-invalid), .validated &:has(:invalid) {
|
|
3
|
+
--x-control-background-color: var(--x-control-invalid-background-color, var(--color-error));
|
|
4
|
+
--x-control-background-color-opacity: var(--x-control-invalid-background-color-opacity, 10%);
|
|
5
|
+
--x-control-border-color: var(--x-control-invalid-border-color, var(--color-error));
|
|
6
|
+
--x-control-border-color-opacity: var(--x-control-invalid-border-color-opacity, 100%);
|
|
7
|
+
--x-control-outline-color: var(--x-control-invalid-outline-color, var(--color-error));
|
|
8
|
+
--x-control-color: var(--x-control-invalid-color, var(--color-error));
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
:root, :host {
|
|
2
|
+
--x-control-height: 3rem;
|
|
3
|
+
--x-control-height-textarea: 8rem;
|
|
4
|
+
--x-control-padding-inline: 0.75rem;
|
|
5
|
+
--x-control-padding-block: 0.75rem;
|
|
6
|
+
--x-control-border-width: 1px;
|
|
7
|
+
--x-control-border-radius: var(--radius);
|
|
8
|
+
--x-control-border-color: currentColor;
|
|
9
|
+
--x-control-font-weight: var(--font-weight-medium);
|
|
10
|
+
--x-control-font-size: var(--font-size-sm);
|
|
11
|
+
--x-control-background-color: transparent;
|
|
12
|
+
--x-control-color: currentColor;
|
|
13
|
+
--x-control-outline-width: 3px;
|
|
14
|
+
--x-control-placeholder-color: currentColor;
|
|
15
|
+
--x-control-placeholder-opacity: 50%;
|
|
16
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# [Control](https://winduum.dev/docs/components/control.html)
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
```shell
|
|
5
|
+
npm i winduum
|
|
6
|
+
```
|
|
7
|
+
Learn more how to set up Winduum [here](https://winduum.dev/docs/).
|
|
8
|
+
Include CSS either globally or to your component _([you can't use TailwindCSS layers in per-component CSS](https://tailwindcss.com/docs/adding-custom-styles#layers-and-per-component-css))_
|
|
9
|
+
|
|
10
|
+
```css
|
|
11
|
+
@import "winduum/src/components/control/index.css" layer(components);
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
or modular (you can use your own props or CSS)
|
|
15
|
+
|
|
16
|
+
```css
|
|
17
|
+
@import "winduum/src/components/control/props/default.css" layer(components);
|
|
18
|
+
@import "winduum/src/components/control/props/color.css" layer(components);
|
|
19
|
+
@import "winduum/src/components/control/props/icon.css" layer(components);
|
|
20
|
+
@import "winduum/src/components/control/props/floating.css" layer(components);
|
|
21
|
+
@import "winduum/src/components/control/props/select.css" layer(components);
|
|
22
|
+
@import "winduum/src/components/control/default.css" layer(components);
|
|
23
|
+
@import "winduum/src/components/control/interactive.css" layer(components);
|
|
24
|
+
@import "winduum/src/components/control/invalid.css" layer(components);
|
|
25
|
+
@import "winduum/src/components/control/color.css" layer(components);
|
|
26
|
+
@import "winduum/src/components/control/icon.css" layer(components);
|
|
27
|
+
@import "winduum/src/components/control/file.css" layer(components);
|
|
28
|
+
@import "winduum/src/components/control/floating.css" layer(components);
|
|
29
|
+
@import "winduum/src/components/control/floating-interactive.css" layer(components);
|
|
30
|
+
@import "winduum/src/components/control/select.css" layer(components);
|
|
31
|
+
@import "winduum/src/components/control/select-multiple.css" layer(components);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Local imports
|
|
35
|
+
By default, imports are directly from `npm` so you can leverage updates.
|
|
36
|
+
You can also copy and paste the code from this directory to your project and remap the imports to local.
|
|
37
|
+
|
|
38
|
+
```css
|
|
39
|
+
@import "@/components/control/assets/index.css" layer(components);
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Docs
|
|
43
|
+
Visit [docs](https://winduum.dev/docs/components/control.html) to learn more about usage examples.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.x-control:has(select:not([multiple])) {
|
|
2
|
+
--x-control-padding-inline-end: calc(var(--x-control-end) + var(--x-control-padding-inline) + var(--x-control-select-icon-margin-inline-end));
|
|
3
|
+
|
|
4
|
+
&:has(.ms-auto) {
|
|
5
|
+
--x-control-icon-count-end: 2;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
&::after {
|
|
9
|
+
inline-size: var(--x-control-select-icon-size);
|
|
10
|
+
block-size: var(--x-control-select-icon-size);
|
|
11
|
+
mask: var(--mask-angle-down);
|
|
12
|
+
margin-inline: auto var(--x-control-select-icon-margin-inline-end);
|
|
13
|
+
grid-area: x-control-padding;
|
|
14
|
+
background-color: currentColor;
|
|
15
|
+
pointer-events: none;
|
|
16
|
+
align-self: center;
|
|
17
|
+
content: "";
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:where(.ms-auto) {
|
|
21
|
+
margin-inline-end: var(--x-control-select-icon-size);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
.
|
|
2
|
-
background-color: var(--color-body-primary);
|
|
3
|
-
border-radius: var(--
|
|
4
|
-
padding: var(--
|
|
5
|
-
inline-size: min(100%, var(--
|
|
1
|
+
.x-dialog-content {
|
|
2
|
+
background-color: var(--x-dialog-content-background-color, var(--color-body-primary));
|
|
3
|
+
border-radius: var(--x-dialog-content-border-radius, var(--radius-3xl));
|
|
4
|
+
padding: var(--x-dialog-content-padding-block) var(--x-dialog-content-padding-inline);
|
|
5
|
+
inline-size: min(100%, var(--x-dialog-content-inline-size));
|
|
6
6
|
transition: var(--transition-transform), var(--transition-opacity);
|
|
7
7
|
margin: auto;
|
|
8
8
|
|
|
9
|
-
:where(dialog
|
|
9
|
+
:where(dialog[data-closed]) & {
|
|
10
10
|
transform: translateY(-2rem);
|
|
11
|
-
opacity: 0
|
|
11
|
+
opacity: 0%;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
.x-dialog {
|
|
2
|
+
z-index: var(--x-dialog-z-index, var(--z-index-30));
|
|
3
|
+
padding: var(--x-dialog-padding-block) var(--x-dialog-padding-inline);
|
|
4
|
+
background-color:
|
|
5
|
+
color-mix(
|
|
6
|
+
in var(--x-dialog-background-color-space, srgb),
|
|
7
|
+
var(--x-dialog-background-color) var(--x-dialog-background-color-opacity),
|
|
8
|
+
var(--x-dialog-background-color-mix, transparent)
|
|
9
|
+
);
|
|
7
10
|
transition: var(--transition-background);
|
|
8
11
|
display: flex;
|
|
9
12
|
position: fixed;
|
|
@@ -12,18 +15,17 @@
|
|
|
12
15
|
overscroll-behavior: contain;
|
|
13
16
|
-webkit-overflow-scrolling: touch;
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
&::backdrop, &:not([open]) {
|
|
19
|
+
display: none;
|
|
17
20
|
}
|
|
18
21
|
|
|
19
|
-
|
|
22
|
+
&[data-closed] {
|
|
20
23
|
background-color: transparent;
|
|
21
|
-
pointer-events: none;
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
html:has(.
|
|
26
|
-
padding-inline-end: var(--
|
|
27
|
+
html:has(.x-dialog[open]) {
|
|
28
|
+
padding-inline-end: var(--default-scrollbar-width);
|
|
27
29
|
scrollbar-width: none;
|
|
28
30
|
|
|
29
31
|
&::-webkit-scrollbar {
|
|
@@ -1,26 +1,11 @@
|
|
|
1
1
|
export interface DefaultOptions {
|
|
2
2
|
remove?: boolean | null
|
|
3
3
|
closable?: boolean | null
|
|
4
|
-
|
|
4
|
+
openAttribute?: string
|
|
5
|
+
closedAttribute?: string
|
|
5
6
|
scrollbarWidthProperty?: string
|
|
6
7
|
}
|
|
7
8
|
|
|
8
|
-
export interface InsertDialogOptions {
|
|
9
|
-
selector?: string | null
|
|
10
|
-
class?: string | null
|
|
11
|
-
append?: boolean | null
|
|
12
|
-
show?: DefaultOptions
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface FetchDialogOptions {
|
|
16
|
-
url: string
|
|
17
|
-
insert?: InsertDialogOptions
|
|
18
|
-
}
|
|
19
|
-
|
|
20
9
|
export const defaultOptions: DefaultOptions
|
|
21
|
-
export function
|
|
22
|
-
export function
|
|
23
|
-
export function showDialog(element: HTMLDialogElement, options?: DefaultOptions): Promise<void>
|
|
24
|
-
export function closeDialog(element: HTMLDialogElement, options?: DefaultOptions): Promise<void>
|
|
25
|
-
export function insertDialog(content: string, options?: InsertDialogOptions): Promise<void>
|
|
26
|
-
export function fetchDialog({ url, insert }: FetchDialogOptions): Promise<void>
|
|
10
|
+
export function showDialog(element: HTMLDialogElement | HTMLElement, options?: DefaultOptions): Promise<void>
|
|
11
|
+
export function closeDialog(element: HTMLDialogElement | HTMLElement, options?: DefaultOptions): Promise<void>
|
|
@@ -1,48 +1,24 @@
|
|
|
1
|
-
import { animationsFinished
|
|
1
|
+
import { animationsFinished } from '../../common.js'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @type {import("./").DefaultOptions}
|
|
5
5
|
*/
|
|
6
6
|
export const defaultOptions = {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
closedAttribute: 'data-closed',
|
|
8
|
+
openAttribute: 'data-open',
|
|
9
|
+
scrollbarWidthProperty: '--default-scrollbar-width',
|
|
10
|
+
closable: true,
|
|
9
11
|
remove: false
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
/**
|
|
13
|
-
* @param {string} selector.
|
|
14
|
-
* @return HTMLDialogElement
|
|
15
|
-
*/
|
|
16
|
-
export const dialogSelector = selector => document.querySelectorAll(selector)[document.querySelectorAll(selector).length - 1]
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Dismisses a dialog.
|
|
20
|
-
* @param {HTMLDialogElement} element - The dialog element to dismiss.
|
|
21
|
-
* @param {import("./").DefaultOptions} options - The options for closing the dialog.
|
|
22
|
-
* @returns Promise<void>
|
|
23
|
-
*/
|
|
24
|
-
export const dismissDialog = async (element, options = defaultOptions) => {
|
|
25
|
-
await animationsFinished(element)
|
|
26
|
-
element.inert = true
|
|
27
|
-
element.classList.remove(options.openClass)
|
|
28
|
-
element.dispatchEvent(new CustomEvent('c-dialog:dismiss'))
|
|
29
|
-
|
|
30
|
-
options.remove && element.remove()
|
|
31
|
-
|
|
32
|
-
if (!document.querySelector('dialog[open]')) {
|
|
33
|
-
document.documentElement.style.removeProperty(options.scrollbarWidthProperty)
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
14
|
/**
|
|
38
15
|
* Shows a dialog.
|
|
39
|
-
* @param {HTMLDialogElement |
|
|
16
|
+
* @param {HTMLDialogElement | HTMLElement} element - The dialog element to show.
|
|
40
17
|
* @param {import("./").DefaultOptions} options - The options for showing the dialog.
|
|
41
18
|
* @returns Promise<void>
|
|
42
19
|
*/
|
|
43
20
|
export const showDialog = async (element, options = {}) => {
|
|
44
21
|
options = {
|
|
45
|
-
closable: true,
|
|
46
22
|
...defaultOptions,
|
|
47
23
|
...options
|
|
48
24
|
}
|
|
@@ -50,11 +26,9 @@ export const showDialog = async (element, options = {}) => {
|
|
|
50
26
|
document.documentElement.style.setProperty(options.scrollbarWidthProperty, `${window.innerWidth - document.body.clientWidth}px`)
|
|
51
27
|
|
|
52
28
|
if (!element?._dialogHasEvents) {
|
|
53
|
-
element.addEventListener('
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
options.closable && closeDialog(element, options)
|
|
57
|
-
}
|
|
29
|
+
element.addEventListener('cancel', e => {
|
|
30
|
+
e.preventDefault()
|
|
31
|
+
options.closable && closeDialog(element, options)
|
|
58
32
|
})
|
|
59
33
|
|
|
60
34
|
element.addEventListener('click', ({ target }) => {
|
|
@@ -66,19 +40,21 @@ export const showDialog = async (element, options = {}) => {
|
|
|
66
40
|
element._dialogHasEvents = true
|
|
67
41
|
}
|
|
68
42
|
|
|
69
|
-
element.
|
|
70
|
-
|
|
43
|
+
element.setAttribute(options.closedAttribute, '')
|
|
44
|
+
|
|
45
|
+
element.showModal()
|
|
46
|
+
element.scroll(0, 0)
|
|
71
47
|
|
|
72
|
-
|
|
48
|
+
element.removeAttribute(options.closedAttribute)
|
|
49
|
+
await animationsFinished(element.lastElementChild)
|
|
50
|
+
element.setAttribute(options.openAttribute, '')
|
|
73
51
|
|
|
74
|
-
|
|
75
|
-
? element.showModal()
|
|
76
|
-
: element.setAttribute('open', '')
|
|
52
|
+
element.dispatchEvent(new CustomEvent('x-dialog:show'))
|
|
77
53
|
}
|
|
78
54
|
|
|
79
55
|
/**
|
|
80
56
|
* Closes and dismisses a dialog.
|
|
81
|
-
* @param {HTMLDialogElement} element - The dialog element to dismiss.
|
|
57
|
+
* @param {HTMLDialogElement | HTMLElement} element - The dialog element to dismiss.
|
|
82
58
|
* @param {import("./").DefaultOptions} options - The options for closing the dialog.
|
|
83
59
|
* @returns Promise<void>
|
|
84
60
|
*/
|
|
@@ -88,48 +64,13 @@ export const closeDialog = async (element, options = {}) => {
|
|
|
88
64
|
...options
|
|
89
65
|
}
|
|
90
66
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
: element.removeAttribute('open')
|
|
67
|
+
element.removeAttribute(options.openAttribute)
|
|
68
|
+
element.setAttribute(options.closedAttribute, '')
|
|
94
69
|
|
|
95
|
-
await
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Inserts a dialog into the DOM.
|
|
100
|
-
* @param {string} content - The HTML content to insert into the dialog.
|
|
101
|
-
* @param {import("./").InsertDialogOptions} options - The options for inserting the dialog.
|
|
102
|
-
* @returns Promise<void>
|
|
103
|
-
*/
|
|
104
|
-
export const insertDialog = async (content, options = {}) => {
|
|
105
|
-
options = {
|
|
106
|
-
selector: 'dialog.inserted',
|
|
107
|
-
class: 'inserted',
|
|
108
|
-
append: false,
|
|
109
|
-
show: {
|
|
110
|
-
remove: true
|
|
111
|
-
},
|
|
112
|
-
...options
|
|
113
|
-
}
|
|
70
|
+
await animationsFinished(element.lastElementChild)
|
|
114
71
|
|
|
115
|
-
|
|
116
|
-
dialog.classList.add(options.class)
|
|
72
|
+
element.close()
|
|
117
73
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
} else {
|
|
121
|
-
dialogSelector(options.selector).outerHTML = dialog.outerHTML
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
await showDialog(dialogSelector(options.selector), options.show)
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Fetches a dialog from a URL and inserts it into the DOM.
|
|
129
|
-
* @param {import("./").FetchDialogOptions} options - The options for fetching and inserting the dialog.
|
|
130
|
-
*/
|
|
131
|
-
export const fetchDialog = async ({ url, insert = {} }) => {
|
|
132
|
-
await fetch(url, { headers: { 'X-Requested-With': 'XMLHttpRequest' } })
|
|
133
|
-
.then(response => response.json())
|
|
134
|
-
.then(async ({ content }) => await insertDialog(content, insert))
|
|
74
|
+
element.dispatchEvent(new CustomEvent('x-dialog:close'))
|
|
75
|
+
options.remove && element.remove()
|
|
135
76
|
}
|
|
@@ -14,9 +14,9 @@ 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/dialog/default
|
|
17
|
+
@import "winduum/src/components/dialog/props/default.css" layer(components);
|
|
18
|
+
@import "winduum/src/components/dialog/props/content.css" layer(components);
|
|
18
19
|
@import "winduum/src/components/dialog/default.css" layer(components);
|
|
19
|
-
@import "winduum/src/components/dialog/content-props.css" layer(components);
|
|
20
20
|
@import "winduum/src/components/dialog/content.css" layer(components);
|
|
21
21
|
```
|
|
22
22
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
.x-drawer-content {
|
|
2
|
+
inline-size: var(--x-drawer-content-inline-size);
|
|
3
|
+
block-size: var(--x-drawer-content-block-size);
|
|
4
|
+
background-color: var(--x-drawer-content-background-color);
|
|
4
5
|
flex-shrink: 0;
|
|
5
6
|
scroll-snap-align: end;
|
|
6
|
-
background-color: var(--color-body-primary);
|
|
7
7
|
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
.
|
|
2
|
-
--
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
.x-drawer {
|
|
2
|
+
z-index: var(--x-drawer-z-index, var(--z-index-30));
|
|
3
|
+
background-color:
|
|
4
|
+
color-mix(
|
|
5
|
+
in var(--x-drawer-background-color-space, srgb),
|
|
6
|
+
var(--color-dark) calc(var(--background-color-opacity, 0) * var(--x-drawer-background-color-opacity)),
|
|
7
|
+
var(--x-drawer-background-color-mix, transparent)
|
|
8
|
+
);
|
|
5
9
|
position: fixed;
|
|
6
10
|
inset: 0;
|
|
7
11
|
display: flex;
|
|
8
12
|
overflow: auto hidden;
|
|
9
|
-
background-color: color-mix(in sRGB, var(--color-dark) calc(var(--tw-bg-opacity) * var(--c-drawer-bg-opacity) * 100%), transparent);
|
|
10
13
|
scrollbar-width: none;
|
|
11
14
|
scroll-behavior: smooth;
|
|
12
15
|
-webkit-overflow-scrolling: touch;
|
|
@@ -17,7 +20,7 @@
|
|
|
17
20
|
|
|
18
21
|
&::after {
|
|
19
22
|
content: "";
|
|
20
|
-
min-
|
|
23
|
+
min-inline-size: 100vw;
|
|
21
24
|
scroll-snap-align: end;
|
|
22
25
|
}
|
|
23
26
|
|
|
@@ -26,7 +26,7 @@ export const closeDrawer = (element, distance = element.scrollWidth, direction =
|
|
|
26
26
|
export const scrollDrawer = (element, options = {}) => {
|
|
27
27
|
options = {
|
|
28
28
|
snapClass: 'snap-x snap-mandatory',
|
|
29
|
-
opacityProperty: '--
|
|
29
|
+
opacityProperty: '--background-color-opacity',
|
|
30
30
|
opacityRatio: 1,
|
|
31
31
|
scrollOpen: 0,
|
|
32
32
|
scrollClose: element.scrollWidth - element.clientWidth,
|
|
@@ -43,12 +43,12 @@ export const scrollDrawer = (element, options = {}) => {
|
|
|
43
43
|
if (options.scrollDirection === options.scrollOpen) {
|
|
44
44
|
element.classList.add(...options.snapClass.split(/\s/))
|
|
45
45
|
element.inert = false
|
|
46
|
-
element.dispatchEvent(new CustomEvent('
|
|
46
|
+
element.dispatchEvent(new CustomEvent('x-drawer:open'))
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
if ((options.scrollDirection === options.scrollClose) && !element.inert) {
|
|
50
50
|
element.classList.remove(...options.snapClass.split(/\s/))
|
|
51
51
|
element.inert = true
|
|
52
|
-
element.dispatchEvent(new CustomEvent('
|
|
52
|
+
element.dispatchEvent(new CustomEvent('x-drawer:close'))
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -14,9 +14,9 @@ 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/drawer/default
|
|
17
|
+
@import "winduum/src/components/drawer/props/default.css" layer(components);
|
|
18
|
+
@import "winduum/src/components/drawer/props/content.css" layer(components);
|
|
18
19
|
@import "winduum/src/components/drawer/default.css" layer(components);
|
|
19
|
-
@import "winduum/src/components/drawer/content-props.css" layer(components);
|
|
20
20
|
@import "winduum/src/components/drawer/content.css" layer(components);
|
|
21
21
|
```
|
|
22
22
|
|