@ds-gn/ui 0.6.2 → 0.8.0
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/README.md +21 -3
- package/custom-elements.json +202 -31
- package/dist/components/Background/src/Background.js +1 -13
- package/dist/components/Container/src/Container.d.ts +10 -5
- package/dist/components/Container/src/Container.js +85 -67
- package/dist/components/Container/src/Container.props.d.ts +19 -1
- package/dist/components/Container/src/Container.props.js +9 -4
- package/dist/components/Container/src/Container.styles.d.ts +9 -2
- package/dist/components/FeatureTabs/src/FeatureTabs.d.ts +14 -0
- package/dist/components/FeatureTabs/src/FeatureTabs.js +27 -43
- package/dist/components/FeatureTabs/src/FeatureTabs.styles.d.ts +1 -1
- package/dist/components/Footer/src/Footer.d.ts +5 -9
- package/dist/components/Footer/src/Footer.js +10 -12
- package/dist/components/Heading/src/Heading.js +1 -13
- package/dist/components/Hero/src/Hero.d.ts +5 -0
- package/dist/components/Hero/src/Hero.js +31 -5
- package/dist/components/Hero/src/Hero.styles.d.ts +1 -0
- package/dist/components/Modal/src/Modal.d.ts +4 -1
- package/dist/components/Modal/src/Modal.js +49 -264
- package/dist/components/Modal/src/Modal.props.d.ts +3 -0
- package/dist/components/Modal/src/Modal.props.js +9 -0
- package/dist/components/Modal/src/Modal.styles.d.ts +3 -7
- package/dist/components/Nav/src/Nav.js +2 -9
- package/dist/styles/hero-fallback.css +503 -0
- package/dist/styles/layout-fallback.css +168 -0
- package/package.json +11 -7
- package/dist/common/helpers/motion.d.ts +0 -9
|
@@ -11,6 +11,8 @@ var __legacyDecorateClassTS = function(decorators, target, key, desc) {
|
|
|
11
11
|
|
|
12
12
|
// components/Modal/src/Modal.ts
|
|
13
13
|
import"../../Button/src/Button.js";
|
|
14
|
+
import { cancel } from "@ds-gn/motion";
|
|
15
|
+
import { MotionController } from "@ds-gn/motion/lit";
|
|
14
16
|
import { html as html2, nothing } from "lit";
|
|
15
17
|
import { property, query, state } from "lit/decorators.js";
|
|
16
18
|
|
|
@@ -146,9 +148,6 @@ var styles2 = css2`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.co
|
|
|
146
148
|
--font-weight-semibold: 600;
|
|
147
149
|
--default-transition-duration: 150ms;
|
|
148
150
|
--default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
149
|
-
--duration-moderate: var(--dsgn-src-duration-moderate, 240ms);
|
|
150
|
-
--duration-quick: var(--dsgn-src-duration-quick, 180ms);
|
|
151
|
-
--ease-emphasized: var(--dsgn-src-ease-emphasized, cubic-bezier(0.16, 1, 0.3, 1));
|
|
152
151
|
--radius-surface: var(--dsgn-src-radius-surface, 1rem);
|
|
153
152
|
--color-accent: inherit;
|
|
154
153
|
--color-focus: inherit;
|
|
@@ -156,29 +155,6 @@ var styles2 = css2`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.co
|
|
|
156
155
|
--color-text-primary: inherit;
|
|
157
156
|
--color-text-secondary: inherit;
|
|
158
157
|
--shadow-card: inherit;
|
|
159
|
-
--animate-fade-in: fade-in var(--duration-moderate) var(--ease-emphasized)
|
|
160
|
-
both;
|
|
161
|
-
--animate-fade-out: fade-out var(--duration-quick) var(--ease-emphasized) both;
|
|
162
|
-
--animate-scale-in: scale-in var(--duration-moderate) var(--ease-emphasized)
|
|
163
|
-
both;
|
|
164
|
-
--animate-scale-out: scale-out var(--duration-quick) var(--ease-emphasized)
|
|
165
|
-
both;
|
|
166
|
-
--animate-slide-in-left: slide-in-left var(--duration-moderate)
|
|
167
|
-
var(--ease-emphasized) both;
|
|
168
|
-
--animate-slide-out-left: slide-out-left var(--duration-quick)
|
|
169
|
-
var(--ease-emphasized) both;
|
|
170
|
-
--animate-slide-in-right: slide-in-right var(--duration-moderate)
|
|
171
|
-
var(--ease-emphasized) both;
|
|
172
|
-
--animate-slide-out-right: slide-out-right var(--duration-quick)
|
|
173
|
-
var(--ease-emphasized) both;
|
|
174
|
-
--animate-slide-in-top: slide-in-top var(--duration-moderate)
|
|
175
|
-
var(--ease-emphasized) both;
|
|
176
|
-
--animate-slide-out-top: slide-out-top var(--duration-quick)
|
|
177
|
-
var(--ease-emphasized) both;
|
|
178
|
-
--animate-slide-in-bottom: slide-in-bottom var(--duration-moderate)
|
|
179
|
-
var(--ease-emphasized) both;
|
|
180
|
-
--animate-slide-out-bottom: slide-out-bottom var(--duration-quick)
|
|
181
|
-
var(--ease-emphasized) both;
|
|
182
158
|
}
|
|
183
159
|
}
|
|
184
160
|
@layer utilities {
|
|
@@ -640,122 +616,6 @@ var styles2 = css2`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.co
|
|
|
640
616
|
--dsgn-modal-size: 56rem;
|
|
641
617
|
}
|
|
642
618
|
}
|
|
643
|
-
.data-\\[state\\=closed\\]\\:backdrop\\:animate-fade-out {
|
|
644
|
-
&[data-state="closed"] {
|
|
645
|
-
&::backdrop {
|
|
646
|
-
animation: var(--animate-fade-out);
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
.data-\\[motion\\=bottom\\]\\:data-\\[state\\=closed\\]\\:animate-slide-out-bottom {
|
|
651
|
-
&[data-motion="bottom"] {
|
|
652
|
-
&[data-state="closed"] {
|
|
653
|
-
animation: var(--animate-slide-out-bottom);
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
.data-\\[motion\\=center\\]\\:data-\\[state\\=closed\\]\\:animate-scale-out {
|
|
658
|
-
&[data-motion="center"] {
|
|
659
|
-
&[data-state="closed"] {
|
|
660
|
-
animation: var(--animate-scale-out);
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
.data-\\[motion\\=left\\]\\:data-\\[state\\=closed\\]\\:animate-slide-out-left {
|
|
665
|
-
&[data-motion="left"] {
|
|
666
|
-
&[data-state="closed"] {
|
|
667
|
-
animation: var(--animate-slide-out-left);
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
.data-\\[motion\\=none\\]\\:data-\\[state\\=closed\\]\\:animate-fade-out {
|
|
672
|
-
&[data-motion="none"] {
|
|
673
|
-
&[data-state="closed"] {
|
|
674
|
-
animation: var(--animate-fade-out);
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
.data-\\[motion\\=right\\]\\:data-\\[state\\=closed\\]\\:animate-slide-out-right {
|
|
679
|
-
&[data-motion="right"] {
|
|
680
|
-
&[data-state="closed"] {
|
|
681
|
-
animation: var(--animate-slide-out-right);
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
.data-\\[motion\\=top\\]\\:data-\\[state\\=closed\\]\\:animate-slide-out-top {
|
|
686
|
-
&[data-motion="top"] {
|
|
687
|
-
&[data-state="closed"] {
|
|
688
|
-
animation: var(--animate-slide-out-top);
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
.data-\\[state\\=open\\]\\:backdrop\\:animate-fade-in {
|
|
693
|
-
&[data-state="open"] {
|
|
694
|
-
&::backdrop {
|
|
695
|
-
animation: var(--animate-fade-in);
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
.data-\\[motion\\=bottom\\]\\:data-\\[state\\=open\\]\\:animate-slide-in-bottom {
|
|
700
|
-
&[data-motion="bottom"] {
|
|
701
|
-
&[data-state="open"] {
|
|
702
|
-
animation: var(--animate-slide-in-bottom);
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
.data-\\[motion\\=center\\]\\:data-\\[state\\=open\\]\\:animate-scale-in {
|
|
707
|
-
&[data-motion="center"] {
|
|
708
|
-
&[data-state="open"] {
|
|
709
|
-
animation: var(--animate-scale-in);
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
.data-\\[motion\\=left\\]\\:data-\\[state\\=open\\]\\:animate-slide-in-left {
|
|
714
|
-
&[data-motion="left"] {
|
|
715
|
-
&[data-state="open"] {
|
|
716
|
-
animation: var(--animate-slide-in-left);
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
.data-\\[motion\\=none\\]\\:data-\\[state\\=open\\]\\:animate-fade-in {
|
|
721
|
-
&[data-motion="none"] {
|
|
722
|
-
&[data-state="open"] {
|
|
723
|
-
animation: var(--animate-fade-in);
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
.data-\\[motion\\=right\\]\\:data-\\[state\\=open\\]\\:animate-slide-in-right {
|
|
728
|
-
&[data-motion="right"] {
|
|
729
|
-
&[data-state="open"] {
|
|
730
|
-
animation: var(--animate-slide-in-right);
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
.data-\\[motion\\=top\\]\\:data-\\[state\\=open\\]\\:animate-slide-in-top {
|
|
735
|
-
&[data-motion="top"] {
|
|
736
|
-
&[data-state="open"] {
|
|
737
|
-
animation: var(--animate-slide-in-top);
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
.motion-reduce\\:data-\\[motion\\]\\:data-\\[state\\=closed\\]\\:animate-fade-out {
|
|
742
|
-
@media (prefers-reduced-motion: reduce) {
|
|
743
|
-
&[data-motion] {
|
|
744
|
-
&[data-state="closed"] {
|
|
745
|
-
animation: var(--animate-fade-out);
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
.motion-reduce\\:data-\\[motion\\]\\:data-\\[state\\=open\\]\\:animate-fade-in {
|
|
751
|
-
@media (prefers-reduced-motion: reduce) {
|
|
752
|
-
&[data-motion] {
|
|
753
|
-
&[data-state="open"] {
|
|
754
|
-
animation: var(--animate-fade-in);
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
619
|
}
|
|
760
620
|
@property --dsgn-border-sweep-angle {
|
|
761
621
|
syntax: '<angle>';
|
|
@@ -877,106 +737,6 @@ var styles2 = css2`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.co
|
|
|
877
737
|
inherits: false;
|
|
878
738
|
initial-value: solid;
|
|
879
739
|
}
|
|
880
|
-
@keyframes fade-in {
|
|
881
|
-
from {
|
|
882
|
-
opacity: 0;
|
|
883
|
-
}
|
|
884
|
-
to {
|
|
885
|
-
opacity: 1;
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
|
-
@keyframes fade-out {
|
|
889
|
-
from {
|
|
890
|
-
opacity: 1;
|
|
891
|
-
}
|
|
892
|
-
to {
|
|
893
|
-
opacity: 0;
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
|
-
@keyframes scale-in {
|
|
897
|
-
from {
|
|
898
|
-
opacity: 0;
|
|
899
|
-
transform: scale(0.96);
|
|
900
|
-
}
|
|
901
|
-
to {
|
|
902
|
-
opacity: 1;
|
|
903
|
-
transform: none;
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
@keyframes scale-out {
|
|
907
|
-
from {
|
|
908
|
-
opacity: 1;
|
|
909
|
-
transform: none;
|
|
910
|
-
}
|
|
911
|
-
to {
|
|
912
|
-
opacity: 0;
|
|
913
|
-
transform: scale(0.96);
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
@keyframes slide-in-left {
|
|
917
|
-
from {
|
|
918
|
-
transform: translateX(-100%);
|
|
919
|
-
}
|
|
920
|
-
to {
|
|
921
|
-
transform: none;
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
@keyframes slide-out-left {
|
|
925
|
-
from {
|
|
926
|
-
transform: none;
|
|
927
|
-
}
|
|
928
|
-
to {
|
|
929
|
-
transform: translateX(-100%);
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
@keyframes slide-in-right {
|
|
933
|
-
from {
|
|
934
|
-
transform: translateX(100%);
|
|
935
|
-
}
|
|
936
|
-
to {
|
|
937
|
-
transform: none;
|
|
938
|
-
}
|
|
939
|
-
}
|
|
940
|
-
@keyframes slide-out-right {
|
|
941
|
-
from {
|
|
942
|
-
transform: none;
|
|
943
|
-
}
|
|
944
|
-
to {
|
|
945
|
-
transform: translateX(100%);
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
@keyframes slide-in-top {
|
|
949
|
-
from {
|
|
950
|
-
transform: translateY(-100%);
|
|
951
|
-
}
|
|
952
|
-
to {
|
|
953
|
-
transform: none;
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
@keyframes slide-out-top {
|
|
957
|
-
from {
|
|
958
|
-
transform: none;
|
|
959
|
-
}
|
|
960
|
-
to {
|
|
961
|
-
transform: translateY(-100%);
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
@keyframes slide-in-bottom {
|
|
965
|
-
from {
|
|
966
|
-
transform: translateY(100%);
|
|
967
|
-
}
|
|
968
|
-
to {
|
|
969
|
-
transform: none;
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
@keyframes slide-out-bottom {
|
|
973
|
-
from {
|
|
974
|
-
transform: none;
|
|
975
|
-
}
|
|
976
|
-
to {
|
|
977
|
-
transform: translateY(100%);
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
740
|
@layer properties {
|
|
981
741
|
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
|
982
742
|
*, ::before, ::after, ::backdrop {
|
|
@@ -1031,6 +791,14 @@ var modalMotionValues = {
|
|
|
1031
791
|
TOP: "top",
|
|
1032
792
|
BOTTOM: "bottom"
|
|
1033
793
|
};
|
|
794
|
+
var modalMotionPresets = {
|
|
795
|
+
center: "scaleIn",
|
|
796
|
+
left: "slideInLeft",
|
|
797
|
+
right: "slideInRight",
|
|
798
|
+
top: "slideInTop",
|
|
799
|
+
bottom: "slideInBottom",
|
|
800
|
+
none: "fade"
|
|
801
|
+
};
|
|
1034
802
|
var modalMotionProps = enumCreator(Object.values(modalMotionValues), "motion", String, { reflect: true });
|
|
1035
803
|
var modalSizeValues = {
|
|
1036
804
|
SM: "sm",
|
|
@@ -1077,7 +845,7 @@ var hostStyles = css3`
|
|
|
1077
845
|
display: contents;
|
|
1078
846
|
}
|
|
1079
847
|
`;
|
|
1080
|
-
var dialogClasses = () => clsx_default("box-border", "p-0", "border-0", "overflow-hidden", "flex-col", "open:flex", "text-text-primary", "bg-surface-elevated", "rounded-[var(--radius-surface)]", "shadow-[var(--shadow-card),0_0_18px_color-mix(in_oklab,var(--color-accent)_14.625%,transparent)]", "focus-visible:outline-2", "focus-visible:outline-focus", "focus-visible:outline-offset-2", "[--dsgn-modal-size:32rem]", "[--dsgn-modal-gutter:1rem]", "data-[size=sm]:[--dsgn-modal-size:24rem]", "data-[size=md]:[--dsgn-modal-size:32rem]", "data-[size=lg]:[--dsgn-modal-size:42rem]", "data-[size=xl]:[--dsgn-modal-size:56rem]", "data-[placement=center]:m-auto", "data-[placement=center]:w-[min(var(--dsgn-modal-size),calc(100vw-2*var(--dsgn-modal-gutter)))]", "data-[placement=center]:max-h-[calc(100dvh-2*var(--dsgn-modal-gutter))]", "data-[placement=left]:m-0", "data-[placement=left]:top-0", "data-[placement=left]:bottom-0", "data-[placement=left]:h-dvh", "data-[placement=left]:max-h-dvh", "data-[placement=left]:w-[min(var(--dsgn-modal-size),calc(100vw-var(--dsgn-modal-gutter)))]", "data-[placement=left]:left-0", "data-[placement=left]:right-auto", "data-[placement=left]:rounded-ss-none", "data-[placement=left]:rounded-es-none", "data-[placement=right]:m-0", "data-[placement=right]:top-0", "data-[placement=right]:bottom-0", "data-[placement=right]:h-dvh", "data-[placement=right]:max-h-dvh", "data-[placement=right]:w-[min(var(--dsgn-modal-size),calc(100vw-var(--dsgn-modal-gutter)))]", "data-[placement=right]:left-auto", "data-[placement=right]:right-0", "data-[placement=right]:rounded-se-none", "data-[placement=right]:rounded-ee-none", "data-[placement=top]:m-0", "data-[placement=top]:left-0", "data-[placement=top]:right-0", "data-[placement=top]:w-screen", "data-[placement=top]:max-w-screen", "data-[placement=top]:max-h-[min(var(--dsgn-modal-size),calc(100dvh-var(--dsgn-modal-gutter)))]", "data-[placement=top]:top-0", "data-[placement=top]:bottom-auto", "data-[placement=top]:rounded-ss-none", "data-[placement=top]:rounded-se-none", "data-[placement=bottom]:m-0", "data-[placement=bottom]:left-0", "data-[placement=bottom]:right-0", "data-[placement=bottom]:w-screen", "data-[placement=bottom]:max-w-screen", "data-[placement=bottom]:max-h-[min(var(--dsgn-modal-size),calc(100dvh-var(--dsgn-modal-gutter)))]", "data-[placement=bottom]:top-auto", "data-[placement=bottom]:bottom-0", "data-[placement=bottom]:rounded-es-none", "data-[placement=bottom]:rounded-ee-none", "data-[size=full]:inset-0", "data-[size=full]:m-0", "data-[size=full]:w-screen", "data-[size=full]:max-w-screen", "data-[size=full]:h-dvh", "data-[size=full]:max-h-dvh", "data-[size=full]:rounded-none", "backdrop:bg-[rgb(2_6_23/0.6)]", "backdrop:backdrop-blur-[12px]"
|
|
848
|
+
var dialogClasses = () => clsx_default("box-border", "p-0", "border-0", "overflow-hidden", "flex-col", "open:flex", "text-text-primary", "bg-surface-elevated", "rounded-[var(--radius-surface)]", "shadow-[var(--shadow-card),0_0_18px_color-mix(in_oklab,var(--color-accent)_14.625%,transparent)]", "focus-visible:outline-2", "focus-visible:outline-focus", "focus-visible:outline-offset-2", "[--dsgn-modal-size:32rem]", "[--dsgn-modal-gutter:1rem]", "data-[size=sm]:[--dsgn-modal-size:24rem]", "data-[size=md]:[--dsgn-modal-size:32rem]", "data-[size=lg]:[--dsgn-modal-size:42rem]", "data-[size=xl]:[--dsgn-modal-size:56rem]", "data-[placement=center]:m-auto", "data-[placement=center]:w-[min(var(--dsgn-modal-size),calc(100vw-2*var(--dsgn-modal-gutter)))]", "data-[placement=center]:max-h-[calc(100dvh-2*var(--dsgn-modal-gutter))]", "data-[placement=left]:m-0", "data-[placement=left]:top-0", "data-[placement=left]:bottom-0", "data-[placement=left]:h-dvh", "data-[placement=left]:max-h-dvh", "data-[placement=left]:w-[min(var(--dsgn-modal-size),calc(100vw-var(--dsgn-modal-gutter)))]", "data-[placement=left]:left-0", "data-[placement=left]:right-auto", "data-[placement=left]:rounded-ss-none", "data-[placement=left]:rounded-es-none", "data-[placement=right]:m-0", "data-[placement=right]:top-0", "data-[placement=right]:bottom-0", "data-[placement=right]:h-dvh", "data-[placement=right]:max-h-dvh", "data-[placement=right]:w-[min(var(--dsgn-modal-size),calc(100vw-var(--dsgn-modal-gutter)))]", "data-[placement=right]:left-auto", "data-[placement=right]:right-0", "data-[placement=right]:rounded-se-none", "data-[placement=right]:rounded-ee-none", "data-[placement=top]:m-0", "data-[placement=top]:left-0", "data-[placement=top]:right-0", "data-[placement=top]:w-screen", "data-[placement=top]:max-w-screen", "data-[placement=top]:max-h-[min(var(--dsgn-modal-size),calc(100dvh-var(--dsgn-modal-gutter)))]", "data-[placement=top]:top-0", "data-[placement=top]:bottom-auto", "data-[placement=top]:rounded-ss-none", "data-[placement=top]:rounded-se-none", "data-[placement=bottom]:m-0", "data-[placement=bottom]:left-0", "data-[placement=bottom]:right-0", "data-[placement=bottom]:w-screen", "data-[placement=bottom]:max-w-screen", "data-[placement=bottom]:max-h-[min(var(--dsgn-modal-size),calc(100dvh-var(--dsgn-modal-gutter)))]", "data-[placement=bottom]:top-auto", "data-[placement=bottom]:bottom-0", "data-[placement=bottom]:rounded-es-none", "data-[placement=bottom]:rounded-ee-none", "data-[size=full]:inset-0", "data-[size=full]:m-0", "data-[size=full]:w-screen", "data-[size=full]:max-w-screen", "data-[size=full]:h-dvh", "data-[size=full]:max-h-dvh", "data-[size=full]:rounded-none", "backdrop:bg-[rgb(2_6_23/0.6)]", "backdrop:backdrop-blur-[12px]");
|
|
1081
849
|
var panelClasses = () => clsx_default("flex", "flex-col", "flex-auto", "min-h-0", "font-sans");
|
|
1082
850
|
var headerClasses = (visible) => clsx_default("shrink-0", "items-start", "justify-between", "gap-4", "px-6", "pt-6", "pb-2", visible ? "flex" : "hidden");
|
|
1083
851
|
var headingClasses = () => clsx_default("min-w-0", "text-lg", "font-semibold", "text-text-primary");
|
|
@@ -1118,17 +886,6 @@ var unlockBodyScroll = () => {
|
|
|
1118
886
|
document.body.style.removeProperty("overflow");
|
|
1119
887
|
}
|
|
1120
888
|
};
|
|
1121
|
-
var whenAnimationsSettle = async (dialog) => {
|
|
1122
|
-
if (typeof dialog.getAnimations !== "function")
|
|
1123
|
-
return;
|
|
1124
|
-
const animations = dialog.getAnimations({ subtree: true }).filter((animation) => {
|
|
1125
|
-
const effect = animation.effect;
|
|
1126
|
-
return effect?.target === dialog;
|
|
1127
|
-
});
|
|
1128
|
-
if (animations.length === 0)
|
|
1129
|
-
return;
|
|
1130
|
-
await Promise.allSettled(animations.map((animation) => animation.finished));
|
|
1131
|
-
};
|
|
1132
889
|
var isInTopLayer = (dialog) => {
|
|
1133
890
|
try {
|
|
1134
891
|
return dialog.matches(":modal");
|
|
@@ -1150,7 +907,9 @@ class Modal extends Base {
|
|
|
1150
907
|
this.noCloseControl = false;
|
|
1151
908
|
this.noBackdropDismiss = false;
|
|
1152
909
|
this.noEscapeDismiss = false;
|
|
910
|
+
this._motion = new MotionController(this);
|
|
1153
911
|
this._closing = false;
|
|
912
|
+
this._closeRun = 0;
|
|
1154
913
|
this._hasHeading = false;
|
|
1155
914
|
this._hasDescription = false;
|
|
1156
915
|
this._hasFooter = false;
|
|
@@ -1191,11 +950,13 @@ class Modal extends Base {
|
|
|
1191
950
|
}
|
|
1192
951
|
connectedCallback() {
|
|
1193
952
|
super.connectedCallback();
|
|
1194
|
-
if (this.open) {
|
|
953
|
+
if (this.open || this._dialog?.open) {
|
|
1195
954
|
this.updateComplete.then(() => this._syncDialogState());
|
|
1196
955
|
}
|
|
1197
956
|
}
|
|
1198
957
|
disconnectedCallback() {
|
|
958
|
+
this._closeRun += 1;
|
|
959
|
+
this._closing = false;
|
|
1199
960
|
super.disconnectedCallback();
|
|
1200
961
|
this._releaseScrollLock();
|
|
1201
962
|
}
|
|
@@ -1208,11 +969,23 @@ class Modal extends Base {
|
|
|
1208
969
|
}
|
|
1209
970
|
_syncDialogState() {
|
|
1210
971
|
const dialog = this._dialog;
|
|
1211
|
-
if (!dialog)
|
|
972
|
+
if (!dialog || !this.isConnected)
|
|
1212
973
|
return;
|
|
1213
974
|
if (this.open) {
|
|
1214
|
-
|
|
975
|
+
this._closeReason = modalCloseReasonValues.API;
|
|
976
|
+
this._returnValue = "";
|
|
977
|
+
if (this._closing) {
|
|
978
|
+
this._closing = false;
|
|
979
|
+
this._closeRun += 1;
|
|
980
|
+
if (isInTopLayer(dialog)) {
|
|
981
|
+
this._animateDialog(dialog, true);
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
if (isInTopLayer(dialog)) {
|
|
986
|
+
this._acquireScrollLock();
|
|
1215
987
|
return;
|
|
988
|
+
}
|
|
1216
989
|
this._openDialog(dialog);
|
|
1217
990
|
} else if (dialog.open) {
|
|
1218
991
|
this._runCloseSequence(dialog);
|
|
@@ -1222,25 +995,38 @@ class Modal extends Base {
|
|
|
1222
995
|
if (dialog.open)
|
|
1223
996
|
dialog.close();
|
|
1224
997
|
this._closing = false;
|
|
1225
|
-
this._previouslyFocused
|
|
998
|
+
this._previouslyFocused ??= deepActiveElement();
|
|
1226
999
|
dialog.returnValue = "";
|
|
1227
1000
|
dialog.showModal();
|
|
1228
1001
|
this._acquireScrollLock();
|
|
1229
1002
|
this._focusInitialElement(dialog);
|
|
1003
|
+
this._animateDialog(dialog, true);
|
|
1230
1004
|
this.emit("dsgn-modal-open");
|
|
1231
1005
|
}
|
|
1232
1006
|
async _runCloseSequence(dialog) {
|
|
1233
1007
|
if (this._closing)
|
|
1234
1008
|
return;
|
|
1235
1009
|
this._closing = true;
|
|
1236
|
-
|
|
1237
|
-
await
|
|
1010
|
+
const run = ++this._closeRun;
|
|
1011
|
+
await this._animateDialog(dialog, false);
|
|
1012
|
+
if (run !== this._closeRun || !this.isConnected)
|
|
1013
|
+
return;
|
|
1238
1014
|
if (!dialog.open || this.open) {
|
|
1239
1015
|
this._closing = false;
|
|
1240
1016
|
return;
|
|
1241
1017
|
}
|
|
1242
1018
|
dialog.close(this._returnValue);
|
|
1243
1019
|
}
|
|
1020
|
+
_animateDialog(dialog, entering) {
|
|
1021
|
+
const preset = modalMotionPresets[this._motionOrigin];
|
|
1022
|
+
const play = entering ? this._motion.enter.bind(this._motion) : this._motion.exit.bind(this._motion);
|
|
1023
|
+
return Promise.all([
|
|
1024
|
+
play(dialog, preset),
|
|
1025
|
+
play(dialog, "fade", { pseudoElement: "::backdrop" })
|
|
1026
|
+
]).then(() => {
|
|
1027
|
+
return;
|
|
1028
|
+
});
|
|
1029
|
+
}
|
|
1244
1030
|
_focusInitialElement(dialog) {
|
|
1245
1031
|
const target = this.querySelector("[autofocus]") ?? dialog.querySelector("[autofocus]") ?? dialog;
|
|
1246
1032
|
target.focus();
|
|
@@ -1266,7 +1052,10 @@ class Modal extends Base {
|
|
|
1266
1052
|
_handleNativeClose() {
|
|
1267
1053
|
if (this._dialog?.open)
|
|
1268
1054
|
return;
|
|
1055
|
+
this._closeRun += 1;
|
|
1269
1056
|
this._closing = false;
|
|
1057
|
+
if (this._dialog)
|
|
1058
|
+
cancel(this._dialog);
|
|
1270
1059
|
this.open = false;
|
|
1271
1060
|
this._releaseScrollLock();
|
|
1272
1061
|
this._restoreFocus();
|
|
@@ -1325,7 +1114,6 @@ class Modal extends Base {
|
|
|
1325
1114
|
data-placement=${this.placement}
|
|
1326
1115
|
data-motion=${this._motionOrigin}
|
|
1327
1116
|
data-size=${this.size}
|
|
1328
|
-
data-state=${this._closing ? "closed" : "open"}
|
|
1329
1117
|
aria-label=${!this._hasHeading && this.ariaLabel ? this.ariaLabel : nothing}
|
|
1330
1118
|
aria-labelledby=${this._hasHeading ? "modal-heading" : nothing}
|
|
1331
1119
|
aria-describedby=${this._hasDescription ? "modal-description" : nothing}
|
|
@@ -1412,9 +1200,6 @@ __legacyDecorateClassTS([
|
|
|
1412
1200
|
__legacyDecorateClassTS([
|
|
1413
1201
|
property({ type: Boolean, reflect: true, attribute: "no-escape-dismiss" })
|
|
1414
1202
|
], Modal.prototype, "noEscapeDismiss", undefined);
|
|
1415
|
-
__legacyDecorateClassTS([
|
|
1416
|
-
state()
|
|
1417
|
-
], Modal.prototype, "_closing", undefined);
|
|
1418
1203
|
__legacyDecorateClassTS([
|
|
1419
1204
|
state()
|
|
1420
1205
|
], Modal.prototype, "_hasHeading", undefined);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PresetName } from '@ds-gn/motion';
|
|
1
2
|
/**
|
|
2
3
|
* Where the dialog sits in the viewport. `center` is a classic modal; the four
|
|
3
4
|
* edges are sheets/drawers that span that edge.
|
|
@@ -28,6 +29,8 @@ export declare const modalMotionValues: {
|
|
|
28
29
|
readonly BOTTOM: "bottom";
|
|
29
30
|
};
|
|
30
31
|
export type ModalMotionType = (typeof modalMotionValues)[keyof typeof modalMotionValues];
|
|
32
|
+
/** Motion names select an enter/exit pair; placement remains independent. */
|
|
33
|
+
export declare const modalMotionPresets: Record<Exclude<ModalMotionType, 'inherit'>, PresetName>;
|
|
31
34
|
export declare const modalMotionProps: import("lit").PropertyDeclaration<unknown, unknown>;
|
|
32
35
|
/**
|
|
33
36
|
* Size along the axis the placement grows on: width for `center`/`left`/`right`,
|
|
@@ -39,6 +39,14 @@ var modalMotionValues = {
|
|
|
39
39
|
TOP: "top",
|
|
40
40
|
BOTTOM: "bottom"
|
|
41
41
|
};
|
|
42
|
+
var modalMotionPresets = {
|
|
43
|
+
center: "scaleIn",
|
|
44
|
+
left: "slideInLeft",
|
|
45
|
+
right: "slideInRight",
|
|
46
|
+
top: "slideInTop",
|
|
47
|
+
bottom: "slideInBottom",
|
|
48
|
+
none: "fade"
|
|
49
|
+
};
|
|
42
50
|
var modalMotionProps = enumCreator(Object.values(modalMotionValues), "motion", String, { reflect: true });
|
|
43
51
|
var modalSizeValues = {
|
|
44
52
|
SM: "sm",
|
|
@@ -56,6 +64,7 @@ var modalCloseReasonValues = {
|
|
|
56
64
|
};
|
|
57
65
|
export {
|
|
58
66
|
modalCloseReasonValues,
|
|
67
|
+
modalMotionPresets,
|
|
59
68
|
modalMotionProps,
|
|
60
69
|
modalMotionValues,
|
|
61
70
|
modalPlacementProps,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `:host` is the only rule with no utility equivalent — the host is the
|
|
3
3
|
* consumer's own `<dsgn-modal>` element, so there is no class we can put on it.
|
|
4
|
-
*
|
|
5
|
-
* the enter/exit motion, is expressed as Tailwind utilities in
|
|
4
|
+
* Layout and backdrop styling are expressed as Tailwind utilities in
|
|
6
5
|
* `dialogClasses()` below.
|
|
7
6
|
*/
|
|
8
7
|
export declare const hostStyles: import("lit").CSSResult;
|
|
@@ -10,14 +9,11 @@ export declare const hostStyles: import("lit").CSSResult;
|
|
|
10
9
|
* Every style the `<dialog>` needs, as one static utility list.
|
|
11
10
|
*
|
|
12
11
|
* Nothing here is conditional: the dialog carries `data-placement`,
|
|
13
|
-
* `data-size`,
|
|
12
|
+
* `data-size`, and the `data-[…]:` variants
|
|
14
13
|
* select which rules apply at runtime. That is also a requirement rather than a
|
|
15
14
|
* preference — Tailwind only generates classes it finds as *literal* strings in
|
|
16
15
|
* the source, so these cannot be composed or interpolated.
|
|
17
|
-
*
|
|
18
|
-
* Ordering note: `motion-reduce:` is emitted after the `data-motion` rules and
|
|
19
|
-
* matches their specificity, so it wins — the reduced-motion cross-fade
|
|
20
|
-
* overrides whichever spatial animation the placement selected.
|
|
16
|
+
* Motion is played by MotionController, independently of these styles.
|
|
21
17
|
*/
|
|
22
18
|
export declare const dialogClasses: () => string;
|
|
23
19
|
export declare const panelClasses: () => string;
|
|
@@ -125,10 +125,7 @@ var surfaceValues = {
|
|
|
125
125
|
var surfaceProps = enumCreator(Object.values(surfaceValues), "surface", String, { reflect: true });
|
|
126
126
|
|
|
127
127
|
// components/Nav/src/Nav.ts
|
|
128
|
-
import {
|
|
129
|
-
containerPaddingValues,
|
|
130
|
-
containerSizeValues
|
|
131
|
-
} from "../../Container/src/Container.props.js";
|
|
128
|
+
import { containerSizeValues } from "../../Container/src/Container.props.js";
|
|
132
129
|
// components/Icon/src/icons/menu.ts
|
|
133
130
|
import { svg } from "lit";
|
|
134
131
|
var menu = svg`<line x1="4" x2="20" y1="12" y2="12" /><line x1="4" x2="20" y1="6" y2="6" /><line x1="4" x2="20" y1="18" y2="18" />`;
|
|
@@ -672,11 +669,7 @@ class Nav extends Base {
|
|
|
672
669
|
render() {
|
|
673
670
|
return html2`
|
|
674
671
|
<nav class="${classNames(this.transparent)}">
|
|
675
|
-
<dsgn-container
|
|
676
|
-
size="${containerSizeValues.XXL}"
|
|
677
|
-
padding-x="${containerPaddingValues.SM}"
|
|
678
|
-
padding-y="${containerPaddingValues.NONE}"
|
|
679
|
-
>
|
|
672
|
+
<dsgn-container size="${containerSizeValues.XXL}">
|
|
680
673
|
<div class="${innerClasses()}">
|
|
681
674
|
<div class="${logoClasses()}">
|
|
682
675
|
<slot name="logo"></slot>
|