@openelement/ui 1.0.0-alpha.10 → 1.0.0-alpha.11
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/CUSTOMIZATION.md +3 -3
- package/package.json +2 -22
- package/src/component-recipes.js +2 -60
- package/src/control-recipe.css +21 -0
- package/src/generated-manifest.json +1 -158
- package/src/index.d.ts +1 -5
- package/src/index.js +1 -5
- package/src/open-button.css +120 -0
- package/src/open-button.js +4 -118
- package/src/open-code-block.css +46 -0
- package/src/open-code-block.js +3 -44
- package/src/open-dialog.css +137 -0
- package/src/open-dialog.js +3 -135
- package/src/open-dropdown.css +28 -0
- package/src/open-dropdown.js +4 -26
- package/src/open-input.css +80 -0
- package/src/open-input.js +4 -78
- package/src/open-theme-toggle.css +53 -0
- package/src/open-theme-toggle.js +3 -51
- package/src/overlay-recipe.css +9 -0
- package/src/register.js +1 -9
- package/src/surface-recipe.css +10 -0
- package/src/theme.css +3 -2
- package/src/open-badge.d.ts +0 -139
- package/src/open-badge.js +0 -242
- package/src/open-callout.d.ts +0 -261
- package/src/open-callout.js +0 -502
- package/src/open-card.d.ts +0 -138
- package/src/open-card.js +0 -244
- package/src/open-tabs.d.ts +0 -190
- package/src/open-tabs.js +0 -331
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/* open-code-block — authored component styles, ported verbatim from the pre-#1558
|
|
2
|
+
* recipe() sheet (the alpha.9 design system). The #1558 migration had
|
|
3
|
+
* replaced this with a placeholder shell under the false note that the
|
|
4
|
+
* component "carried no authored styles"; it did — this is that sheet. */
|
|
5
|
+
:host {
|
|
6
|
+
display: block;
|
|
7
|
+
position: relative;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.copy-btn {
|
|
11
|
+
position: absolute;
|
|
12
|
+
top: calc(var(--spacing) * 2);
|
|
13
|
+
right: calc(var(--spacing) * 2);
|
|
14
|
+
background: color-mix(in srgb, var(--color-primary) 14%, transparent);
|
|
15
|
+
color: var(--color-foreground);
|
|
16
|
+
padding: calc(var(--spacing) * 1) calc(var(--spacing) * 3);
|
|
17
|
+
font-size: var(--text-xs);
|
|
18
|
+
font-family: var(--font-sans);
|
|
19
|
+
font-weight: var(--font-weight-semibold);
|
|
20
|
+
border: 0.5px solid transparent;
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
border-radius: var(--radius-md);
|
|
23
|
+
transition: all var(--ease-in-out) var(--default-transition-duration);
|
|
24
|
+
z-index: 1;
|
|
25
|
+
letter-spacing: var(--tracking-wider);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* No ink override on hover: the primary-foreground ink belongs to a brand
|
|
29
|
+
*fill*, and this chip's hover surface is a translucent brand tint
|
|
30
|
+
instead, so the chip keeps the code surface's ink. */
|
|
31
|
+
.copy-btn:hover {
|
|
32
|
+
background: color-mix(in srgb, var(--color-primary) 23%, transparent);
|
|
33
|
+
border-color: var(--color-primary);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
:host(:state(copied)) .copy-btn {
|
|
37
|
+
color: #22c55e;
|
|
38
|
+
border-color: rgba(34,197,94,0.3);
|
|
39
|
+
background: rgba(34,197,94,0.08);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:host(:state(failed)) .copy-btn {
|
|
43
|
+
color: var(--color-destructive);
|
|
44
|
+
border-color: var(--color-destructive);
|
|
45
|
+
}
|
|
46
|
+
|
package/src/open-code-block.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { CODE_BLOCK_CONSTANTS, log
|
|
1
|
+
import { CODE_BLOCK_CONSTANTS, log } from "./component-recipes.js";
|
|
2
2
|
import { OpenElement } from "@openelement/element";
|
|
3
|
+
import openCodeBlockStyles from "./open-code-block.css";
|
|
3
4
|
//#region src/open-code-block.tsx
|
|
4
5
|
const __partProgram = {
|
|
5
6
|
"version": 1,
|
|
@@ -194,49 +195,7 @@ var OpenCodeBlock = class extends OpenElement {
|
|
|
194
195
|
static __elementMetadata = __elementMetadata;
|
|
195
196
|
static props = __compiledProps;
|
|
196
197
|
static observedAttributes = __observedAttributes;
|
|
197
|
-
static styles = [
|
|
198
|
-
:host {
|
|
199
|
-
display: block;
|
|
200
|
-
position: relative;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
.copy-btn {
|
|
204
|
-
position: absolute;
|
|
205
|
-
top: calc(var(--spacing) * 2);
|
|
206
|
-
right: calc(var(--spacing) * 2);
|
|
207
|
-
background: color-mix(in srgb, var(--color-primary) 14%, transparent);
|
|
208
|
-
color: var(--color-foreground);
|
|
209
|
-
padding: calc(var(--spacing) * 1) calc(var(--spacing) * 3);
|
|
210
|
-
font-size: var(--text-xs);
|
|
211
|
-
font-family: var(--font-sans);
|
|
212
|
-
font-weight: var(--font-weight-semibold);
|
|
213
|
-
border: 0.5px solid transparent;
|
|
214
|
-
cursor: pointer;
|
|
215
|
-
border-radius: var(--radius-md);
|
|
216
|
-
transition: all var(--ease-in-out) var(--default-transition-duration);
|
|
217
|
-
z-index: 1;
|
|
218
|
-
letter-spacing: var(--tracking-wider);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
/* No ink override on hover: the primary-foreground ink belongs to a brand
|
|
222
|
-
*fill*, and this chip's hover surface is a translucent brand tint
|
|
223
|
-
instead, so the chip keeps the code surface's ink. */
|
|
224
|
-
.copy-btn:hover {
|
|
225
|
-
background: color-mix(in srgb, var(--color-primary) 23%, transparent);
|
|
226
|
-
border-color: var(--color-primary);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
:host(:state(copied)) .copy-btn {
|
|
230
|
-
color: #22c55e;
|
|
231
|
-
border-color: rgba(34,197,94,0.3);
|
|
232
|
-
background: rgba(34,197,94,0.08);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
:host(:state(failed)) .copy-btn {
|
|
236
|
-
color: var(--color-destructive);
|
|
237
|
-
border-color: var(--color-destructive);
|
|
238
|
-
}
|
|
239
|
-
`)];
|
|
198
|
+
static styles = [openCodeBlockStyles];
|
|
240
199
|
copyLabel = "Copy";
|
|
241
200
|
getCodeText() {
|
|
242
201
|
return this.textContent || "";
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/* open-dialog — authored component styles, ported verbatim from the pre-#1558
|
|
2
|
+
* recipe() sheet (the alpha.9 design system). The #1558 migration had
|
|
3
|
+
* replaced this with a placeholder shell under the false note that the
|
|
4
|
+
* component "carried no authored styles"; it did — this is that sheet. */
|
|
5
|
+
:host {
|
|
6
|
+
display: inline-block;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
::slotted([slot='trigger']) {
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
dialog {
|
|
14
|
+
border: calc(var(--spacing) * 0.25) solid color-mix(in srgb, color-mix(in srgb, var(--color-foreground) 25%, var(--color-border)) 62%, var(--color-primary));
|
|
15
|
+
border-radius: var(--radius-xl);
|
|
16
|
+
background: color-mix(in srgb, var(--color-popover) 92%, transparent);
|
|
17
|
+
color: var(--color-foreground);
|
|
18
|
+
padding: calc(var(--spacing) * 6);
|
|
19
|
+
max-width: min(90vw, 480px);
|
|
20
|
+
box-shadow: inset 0 1px 0 color-mix(in srgb, var(--color-white) 8%, transparent), var(--shadow-2xl);
|
|
21
|
+
font-family: var(--font-sans);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
dialog::backdrop {
|
|
25
|
+
/* Closed base: transparent. The [open] rule carries the zinc-950 scrim
|
|
26
|
+
and starts from transparent, so the scrim fades in on entry and back
|
|
27
|
+
out on exit instead of snapping. */
|
|
28
|
+
background: transparent;
|
|
29
|
+
backdrop-filter: blur(8px);
|
|
30
|
+
/* Exit visibility: with allow-discrete the top-layer membership and the
|
|
31
|
+
display flip wait for the transition, so the scrim fades out instead
|
|
32
|
+
of snapping (the allow-discrete recipe, cf. upstream #591 — open
|
|
33
|
+
upstream, does not gate this landing). */
|
|
34
|
+
transition:
|
|
35
|
+
background-color 0.2s ease-out,
|
|
36
|
+
overlay 0.2s ease-out allow-discrete,
|
|
37
|
+
display 0.2s ease-out allow-discrete;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
dialog[open]::backdrop {
|
|
41
|
+
background: color-mix(in srgb, var(--color-zinc-950) 68%, transparent);
|
|
42
|
+
@starting-style {
|
|
43
|
+
background: transparent;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* Entry AND exit: the closed state is the base rule (opacity 0, lifted);
|
|
48
|
+
opening transitions to the [open] values from the @starting-style
|
|
49
|
+
starting point, closing transitions back to the base — the display and
|
|
50
|
+
overlay legs carry allow-discrete so the dialog stays rendered and in
|
|
51
|
+
the top layer until the exit transition finishes. */
|
|
52
|
+
dialog {
|
|
53
|
+
opacity: 0;
|
|
54
|
+
transform: translateY(-8px);
|
|
55
|
+
transition:
|
|
56
|
+
opacity 0.2s ease-out,
|
|
57
|
+
transform 0.2s ease-out,
|
|
58
|
+
overlay 0.2s ease-out allow-discrete,
|
|
59
|
+
display 0.2s ease-out allow-discrete;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
dialog[open] {
|
|
63
|
+
opacity: 1;
|
|
64
|
+
transform: translateY(0);
|
|
65
|
+
@starting-style {
|
|
66
|
+
opacity: 0;
|
|
67
|
+
transform: translateY(-8px);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* Forced colors: the system owns the palette, so half-opacity frames and
|
|
72
|
+
moving text would fight the forced rendering — the dialog appears and
|
|
73
|
+
dismisses immediately instead (the display leg loses its deferral with
|
|
74
|
+
the transition, which is the graceful degradation). Reduced motion
|
|
75
|
+
collapses the same way. */
|
|
76
|
+
@media (forced-colors: active) {
|
|
77
|
+
dialog,
|
|
78
|
+
dialog::backdrop {
|
|
79
|
+
transition: none;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@media (prefers-reduced-motion: reduce) {
|
|
84
|
+
dialog,
|
|
85
|
+
dialog::backdrop {
|
|
86
|
+
transition-duration: 0s;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.dialog-header {
|
|
91
|
+
display: flex;
|
|
92
|
+
justify-content: space-between;
|
|
93
|
+
align-items: center;
|
|
94
|
+
margin-bottom: calc(var(--spacing) * 4);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.dialog-title {
|
|
98
|
+
font-size: var(--text-xl);
|
|
99
|
+
font-weight: var(--font-weight-semibold);
|
|
100
|
+
color: var(--color-foreground);
|
|
101
|
+
margin: 0;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.dialog-close {
|
|
105
|
+
background: none;
|
|
106
|
+
border: none;
|
|
107
|
+
cursor: pointer;
|
|
108
|
+
color: var(--color-muted-foreground);
|
|
109
|
+
font-size: var(--text-xl);
|
|
110
|
+
line-height: var(--leading-tight);
|
|
111
|
+
padding: calc(var(--spacing) * 1);
|
|
112
|
+
border-radius: var(--radius-md);
|
|
113
|
+
transition: color 0.15s ease;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.dialog-close:hover {
|
|
117
|
+
color: var(--color-foreground);
|
|
118
|
+
background: color-mix(in srgb, var(--color-primary) 14%, transparent);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.dialog-body {
|
|
122
|
+
font-size: var(--text-base);
|
|
123
|
+
color: var(--color-muted-foreground);
|
|
124
|
+
line-height: var(--leading-normal);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.dialog-footer {
|
|
128
|
+
margin-top: calc(var(--spacing) * 5);
|
|
129
|
+
display: flex;
|
|
130
|
+
justify-content: flex-end;
|
|
131
|
+
gap: calc(var(--spacing) * 2);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
:host(:state(open)) dialog {
|
|
135
|
+
display: block;
|
|
136
|
+
}
|
|
137
|
+
|
package/src/open-dialog.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readInstanceState, writeInstanceState } from "./instance-state.js";
|
|
2
|
-
import { overlayRecipe, recipe } from "./component-recipes.js";
|
|
3
2
|
import { OpenElement, effect } from "@openelement/element";
|
|
3
|
+
import overlayRecipe from "./overlay-recipe.css";
|
|
4
|
+
import openDialogStyles from "./open-dialog.css";
|
|
4
5
|
//#region src/open-dialog.tsx
|
|
5
6
|
const __partProgram = {
|
|
6
7
|
"version": 1,
|
|
@@ -533,140 +534,7 @@ var OpenDialog = class extends OpenElement {
|
|
|
533
534
|
static props = __compiledProps;
|
|
534
535
|
static observedAttributes = __observedAttributes;
|
|
535
536
|
static delegatesFocus = true;
|
|
536
|
-
static styles = [overlayRecipe,
|
|
537
|
-
:host {
|
|
538
|
-
display: inline-block;
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
::slotted([slot='trigger']) {
|
|
542
|
-
cursor: pointer;
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
dialog {
|
|
546
|
-
border: calc(var(--spacing) * 0.25) solid color-mix(in srgb, color-mix(in srgb, var(--color-foreground) 25%, var(--color-border)) 62%, var(--color-primary));
|
|
547
|
-
border-radius: var(--radius-xl);
|
|
548
|
-
background: color-mix(in srgb, var(--color-popover) 92%, transparent);
|
|
549
|
-
color: var(--color-foreground);
|
|
550
|
-
padding: calc(var(--spacing) * 6);
|
|
551
|
-
max-width: min(90vw, 480px);
|
|
552
|
-
box-shadow: inset 0 1px 0 color-mix(in srgb, var(--color-white) 8%, transparent), var(--shadow-2xl);
|
|
553
|
-
font-family: var(--font-sans);
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
dialog::backdrop {
|
|
557
|
-
/* Closed base: transparent. The [open] rule carries the zinc-950 scrim
|
|
558
|
-
and starts from transparent, so the scrim fades in on entry and back
|
|
559
|
-
out on exit instead of snapping. */
|
|
560
|
-
background: transparent;
|
|
561
|
-
backdrop-filter: blur(8px);
|
|
562
|
-
/* Exit visibility: with allow-discrete the top-layer membership and the
|
|
563
|
-
display flip wait for the transition, so the scrim fades out instead
|
|
564
|
-
of snapping (the allow-discrete recipe, cf. upstream #591 — open
|
|
565
|
-
upstream, does not gate this landing). */
|
|
566
|
-
transition:
|
|
567
|
-
background-color 0.2s ease-out,
|
|
568
|
-
overlay 0.2s ease-out allow-discrete,
|
|
569
|
-
display 0.2s ease-out allow-discrete;
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
dialog[open]::backdrop {
|
|
573
|
-
background: color-mix(in srgb, var(--color-zinc-950) 68%, transparent);
|
|
574
|
-
@starting-style {
|
|
575
|
-
background: transparent;
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
/* Entry AND exit: the closed state is the base rule (opacity 0, lifted);
|
|
580
|
-
opening transitions to the [open] values from the @starting-style
|
|
581
|
-
starting point, closing transitions back to the base — the display and
|
|
582
|
-
overlay legs carry allow-discrete so the dialog stays rendered and in
|
|
583
|
-
the top layer until the exit transition finishes. */
|
|
584
|
-
dialog {
|
|
585
|
-
opacity: 0;
|
|
586
|
-
transform: translateY(-8px);
|
|
587
|
-
transition:
|
|
588
|
-
opacity 0.2s ease-out,
|
|
589
|
-
transform 0.2s ease-out,
|
|
590
|
-
overlay 0.2s ease-out allow-discrete,
|
|
591
|
-
display 0.2s ease-out allow-discrete;
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
dialog[open] {
|
|
595
|
-
opacity: 1;
|
|
596
|
-
transform: translateY(0);
|
|
597
|
-
@starting-style {
|
|
598
|
-
opacity: 0;
|
|
599
|
-
transform: translateY(-8px);
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
/* Forced colors: the system owns the palette, so half-opacity frames and
|
|
604
|
-
moving text would fight the forced rendering — the dialog appears and
|
|
605
|
-
dismisses immediately instead (the display leg loses its deferral with
|
|
606
|
-
the transition, which is the graceful degradation). Reduced motion
|
|
607
|
-
collapses the same way. */
|
|
608
|
-
@media (forced-colors: active) {
|
|
609
|
-
dialog,
|
|
610
|
-
dialog::backdrop {
|
|
611
|
-
transition: none;
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
@media (prefers-reduced-motion: reduce) {
|
|
616
|
-
dialog,
|
|
617
|
-
dialog::backdrop {
|
|
618
|
-
transition-duration: 0s;
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
.dialog-header {
|
|
623
|
-
display: flex;
|
|
624
|
-
justify-content: space-between;
|
|
625
|
-
align-items: center;
|
|
626
|
-
margin-bottom: calc(var(--spacing) * 4);
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
.dialog-title {
|
|
630
|
-
font-size: var(--text-xl);
|
|
631
|
-
font-weight: var(--font-weight-semibold);
|
|
632
|
-
color: var(--color-foreground);
|
|
633
|
-
margin: 0;
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
.dialog-close {
|
|
637
|
-
background: none;
|
|
638
|
-
border: none;
|
|
639
|
-
cursor: pointer;
|
|
640
|
-
color: var(--color-muted-foreground);
|
|
641
|
-
font-size: var(--text-xl);
|
|
642
|
-
line-height: var(--leading-tight);
|
|
643
|
-
padding: calc(var(--spacing) * 1);
|
|
644
|
-
border-radius: var(--radius-md);
|
|
645
|
-
transition: color 0.15s ease;
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
.dialog-close:hover {
|
|
649
|
-
color: var(--color-foreground);
|
|
650
|
-
background: color-mix(in srgb, var(--color-primary) 14%, transparent);
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
.dialog-body {
|
|
654
|
-
font-size: var(--text-base);
|
|
655
|
-
color: var(--color-muted-foreground);
|
|
656
|
-
line-height: var(--leading-normal);
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
.dialog-footer {
|
|
660
|
-
margin-top: calc(var(--spacing) * 5);
|
|
661
|
-
display: flex;
|
|
662
|
-
justify-content: flex-end;
|
|
663
|
-
gap: calc(var(--spacing) * 2);
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
:host(:state(open)) dialog {
|
|
667
|
-
display: block;
|
|
668
|
-
}
|
|
669
|
-
`)];
|
|
537
|
+
static styles = [overlayRecipe, openDialogStyles];
|
|
670
538
|
open = false;
|
|
671
539
|
label = "";
|
|
672
540
|
onCsrRendered() {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* open-dropdown — authored component styles, ported verbatim from the pre-#1558
|
|
2
|
+
* recipe() sheet (the alpha.9 design system). The #1558 migration had
|
|
3
|
+
* replaced this with a placeholder shell under the false note that the
|
|
4
|
+
* component "carried no authored styles"; it did — this is that sheet. */
|
|
5
|
+
:host {
|
|
6
|
+
display: inline-block;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.trigger {
|
|
10
|
+
display: contents;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.content {
|
|
14
|
+
/* The base inset is the placement fallback for engines without CSS Anchor
|
|
15
|
+
Positioning; it must stay present because Firefox's anchor resolution
|
|
16
|
+
only applies anchor() longhands on top of an explicit inset. */
|
|
17
|
+
position: absolute;
|
|
18
|
+
inset: 100% auto auto 0;
|
|
19
|
+
top: anchor(bottom);
|
|
20
|
+
left: anchor(left);
|
|
21
|
+
min-width: 12rem;
|
|
22
|
+
/* The gap rides on margin-top: calc(anchor() + length) resolves without
|
|
23
|
+
the added length in Firefox. */
|
|
24
|
+
margin: calc(var(--spacing) * 2) 0 0;
|
|
25
|
+
padding: calc(var(--spacing) * 2);
|
|
26
|
+
font-family: var(--font-sans);
|
|
27
|
+
}
|
|
28
|
+
|
package/src/open-dropdown.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { readInstanceState, writeInstanceState } from "./instance-state.js";
|
|
2
|
-
import { deepActiveElement, nextInstanceId
|
|
2
|
+
import { deepActiveElement, nextInstanceId } from "./component-recipes.js";
|
|
3
3
|
import { OpenElement, computed } from "@openelement/element";
|
|
4
|
+
import overlayRecipe from "./overlay-recipe.css";
|
|
5
|
+
import openDropdownStyles from "./open-dropdown.css";
|
|
4
6
|
//#region src/open-dropdown.tsx
|
|
5
7
|
const __partProgram = {
|
|
6
8
|
"version": 1,
|
|
@@ -293,31 +295,7 @@ var OpenDropdown = class extends OpenElement {
|
|
|
293
295
|
static props = __compiledProps;
|
|
294
296
|
static observedAttributes = __observedAttributes;
|
|
295
297
|
static __computedFields = { anchorStyle: (__s) => computed(() => __s.anchorName.value === "" ? "" : `position-anchor: ${__s.anchorName.value}`) };
|
|
296
|
-
static styles = [overlayRecipe,
|
|
297
|
-
:host {
|
|
298
|
-
display: inline-block;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
.trigger {
|
|
302
|
-
display: contents;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
.content {
|
|
306
|
-
/* The base inset is the placement fallback for engines without CSS Anchor
|
|
307
|
-
Positioning; it must stay present because Firefox's anchor resolution
|
|
308
|
-
only applies anchor() longhands on top of an explicit inset. */
|
|
309
|
-
position: absolute;
|
|
310
|
-
inset: 100% auto auto 0;
|
|
311
|
-
top: anchor(bottom);
|
|
312
|
-
left: anchor(left);
|
|
313
|
-
min-width: 12rem;
|
|
314
|
-
/* The gap rides on margin-top: calc(anchor() + length) resolves without
|
|
315
|
-
the added length in Firefox. */
|
|
316
|
-
margin: calc(var(--spacing) * 2) 0 0;
|
|
317
|
-
padding: calc(var(--spacing) * 2);
|
|
318
|
-
font-family: var(--font-sans);
|
|
319
|
-
}
|
|
320
|
-
`)];
|
|
298
|
+
static styles = [overlayRecipe, openDropdownStyles];
|
|
321
299
|
anchorName = "";
|
|
322
300
|
onDsdHydrated() {
|
|
323
301
|
this.syncAnchorName();
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/* open-input — authored component styles, ported verbatim from the pre-#1558
|
|
2
|
+
* recipe() sheet (the alpha.9 design system). The #1558 migration had
|
|
3
|
+
* replaced this with a placeholder shell under the false note that the
|
|
4
|
+
* component "carried no authored styles"; it did — this is that sheet. */
|
|
5
|
+
:host {
|
|
6
|
+
display: block;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.input-wrapper {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
gap: calc(var(--spacing) * 2);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
label {
|
|
16
|
+
font-size: var(--text-sm);
|
|
17
|
+
font-weight: var(--font-weight-medium);
|
|
18
|
+
color: var(--color-muted-foreground);
|
|
19
|
+
letter-spacing: var(--tracking-normal);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
label[hidden] {
|
|
23
|
+
display: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.input {
|
|
27
|
+
width: 100%;
|
|
28
|
+
padding: calc(var(--spacing) * 2) calc(var(--spacing) * 3);
|
|
29
|
+
font-family: var(--font-sans);
|
|
30
|
+
font-size: var(--text-base);
|
|
31
|
+
color: var(--color-foreground);
|
|
32
|
+
background: color-mix(in srgb, var(--color-popover) 78%, transparent);
|
|
33
|
+
border: calc(var(--spacing) * 0.25) solid color-mix(in srgb, var(--color-border) 72%, var(--color-primary));
|
|
34
|
+
border-radius: var(--radius-md);
|
|
35
|
+
transition: border-color 0.2s ease, box-shadow 0.2s ease;
|
|
36
|
+
outline: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.input::placeholder {
|
|
40
|
+
color: var(--color-muted-foreground);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.input:hover {
|
|
44
|
+
border-color: color-mix(in srgb, var(--color-violet-400) 74%, var(--color-border));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.input:focus {
|
|
48
|
+
border-color: var(--color-primary);
|
|
49
|
+
box-shadow: 0 0 0 1px var(--color-primary);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.input:disabled {
|
|
53
|
+
opacity: 0.5;
|
|
54
|
+
cursor: not-allowed;
|
|
55
|
+
background: var(--color-muted);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.input--error {
|
|
59
|
+
border-color: var(--color-destructive);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
:host(:state(disabled)) .input {
|
|
63
|
+
opacity: 0.5;
|
|
64
|
+
cursor: not-allowed;
|
|
65
|
+
background: var(--color-muted);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
:host(:state(invalid)) .input {
|
|
69
|
+
border-color: var(--color-destructive);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.error-message {
|
|
73
|
+
font-size: var(--text-xs);
|
|
74
|
+
color: var(--color-destructive);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.error-message[hidden] {
|
|
78
|
+
display: none;
|
|
79
|
+
}
|
|
80
|
+
|
package/src/open-input.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { nextInstanceId, syncDisabledState } from "./component-recipes.js";
|
|
2
2
|
import { OpenElement, computed } from "@openelement/element";
|
|
3
|
+
import controlRecipe from "./control-recipe.css";
|
|
4
|
+
import openInputStyles from "./open-input.css";
|
|
3
5
|
//#region src/open-input.tsx
|
|
4
6
|
const __partProgram = {
|
|
5
7
|
"version": 1,
|
|
@@ -1697,83 +1699,7 @@ var OpenInput = class extends OpenElement {
|
|
|
1697
1699
|
requiredMark: (__s) => computed(() => __s.required.value ? " *" : ""),
|
|
1698
1700
|
describedByAttr: (__s) => computed(() => __s.error.value === "" || __s.inputId.value === "" ? null : `${__s.inputId.value}-error`)
|
|
1699
1701
|
};
|
|
1700
|
-
static styles = [controlRecipe,
|
|
1701
|
-
:host {
|
|
1702
|
-
display: block;
|
|
1703
|
-
}
|
|
1704
|
-
|
|
1705
|
-
.input-wrapper {
|
|
1706
|
-
display: flex;
|
|
1707
|
-
flex-direction: column;
|
|
1708
|
-
gap: calc(var(--spacing) * 2);
|
|
1709
|
-
}
|
|
1710
|
-
|
|
1711
|
-
label {
|
|
1712
|
-
font-size: var(--text-sm);
|
|
1713
|
-
font-weight: var(--font-weight-medium);
|
|
1714
|
-
color: var(--color-muted-foreground);
|
|
1715
|
-
letter-spacing: var(--tracking-normal);
|
|
1716
|
-
}
|
|
1717
|
-
|
|
1718
|
-
label[hidden] {
|
|
1719
|
-
display: none;
|
|
1720
|
-
}
|
|
1721
|
-
|
|
1722
|
-
.input {
|
|
1723
|
-
width: 100%;
|
|
1724
|
-
padding: calc(var(--spacing) * 2) calc(var(--spacing) * 3);
|
|
1725
|
-
font-family: var(--font-sans);
|
|
1726
|
-
font-size: var(--text-base);
|
|
1727
|
-
color: var(--color-foreground);
|
|
1728
|
-
background: color-mix(in srgb, var(--color-popover) 78%, transparent);
|
|
1729
|
-
border: calc(var(--spacing) * 0.25) solid color-mix(in srgb, var(--color-border) 72%, var(--color-primary));
|
|
1730
|
-
border-radius: var(--radius-md);
|
|
1731
|
-
transition: border-color 0.2s ease, box-shadow 0.2s ease;
|
|
1732
|
-
outline: none;
|
|
1733
|
-
}
|
|
1734
|
-
|
|
1735
|
-
.input::placeholder {
|
|
1736
|
-
color: var(--color-muted-foreground);
|
|
1737
|
-
}
|
|
1738
|
-
|
|
1739
|
-
.input:hover {
|
|
1740
|
-
border-color: color-mix(in srgb, var(--color-violet-400) 74%, var(--color-border));
|
|
1741
|
-
}
|
|
1742
|
-
|
|
1743
|
-
.input:focus {
|
|
1744
|
-
border-color: var(--color-primary);
|
|
1745
|
-
box-shadow: 0 0 0 1px var(--color-primary);
|
|
1746
|
-
}
|
|
1747
|
-
|
|
1748
|
-
.input:disabled {
|
|
1749
|
-
opacity: 0.5;
|
|
1750
|
-
cursor: not-allowed;
|
|
1751
|
-
background: var(--color-muted);
|
|
1752
|
-
}
|
|
1753
|
-
|
|
1754
|
-
.input--error {
|
|
1755
|
-
border-color: var(--color-destructive);
|
|
1756
|
-
}
|
|
1757
|
-
|
|
1758
|
-
:host(:state(disabled)) .input {
|
|
1759
|
-
opacity: 0.5;
|
|
1760
|
-
cursor: not-allowed;
|
|
1761
|
-
background: var(--color-muted);
|
|
1762
|
-
}
|
|
1763
|
-
|
|
1764
|
-
:host(:state(invalid)) .input {
|
|
1765
|
-
border-color: var(--color-destructive);
|
|
1766
|
-
}
|
|
1767
|
-
|
|
1768
|
-
.error-message {
|
|
1769
|
-
font-size: var(--text-xs);
|
|
1770
|
-
color: var(--color-destructive);
|
|
1771
|
-
}
|
|
1772
|
-
|
|
1773
|
-
.error-message[hidden] {
|
|
1774
|
-
display: none;
|
|
1775
|
-
}
|
|
1776
|
-
`)];
|
|
1702
|
+
static styles = [controlRecipe, openInputStyles];
|
|
1777
1703
|
type = "text";
|
|
1778
1704
|
placeholder = "";
|
|
1779
1705
|
label = "";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/* open-theme-toggle — authored component styles, ported verbatim from the pre-#1558
|
|
2
|
+
* recipe() sheet (the alpha.9 design system). The #1558 migration had
|
|
3
|
+
* replaced this with a placeholder shell under the false note that the
|
|
4
|
+
* component "carried no authored styles"; it did — this is that sheet. */
|
|
5
|
+
:host {
|
|
6
|
+
display: inline-block;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.theme-toggle {
|
|
10
|
+
display: inline-flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
width: 38px; height: 38px; padding: 0;
|
|
14
|
+
border: calc(var(--spacing) * 0.25) solid color-mix(in srgb, var(--color-border) 72%, var(--color-primary));
|
|
15
|
+
border-radius: calc(infinity * 1px);
|
|
16
|
+
background: color-mix(in srgb, var(--color-popover) 76%, transparent);
|
|
17
|
+
color: var(--color-muted-foreground);
|
|
18
|
+
box-shadow: inset 0 1px 0 color-mix(in srgb, var(--color-background) 70%, transparent);
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
transition: all var(--ease-in-out) var(--default-transition-duration);
|
|
21
|
+
}
|
|
22
|
+
.theme-toggle:hover {
|
|
23
|
+
color: var(--color-foreground);
|
|
24
|
+
border-color: var(--color-violet-400);
|
|
25
|
+
background: color-mix(in srgb, color-mix(in srgb, var(--color-primary) 16%, transparent) 42%, var(--color-popover));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.theme-toggle:focus-visible {
|
|
29
|
+
outline: calc(var(--spacing) * 0.5) solid var(--color-ring);
|
|
30
|
+
outline-offset: calc(var(--spacing) * 0.75);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.theme-toggle svg {
|
|
34
|
+
width: 16px;
|
|
35
|
+
height: 16px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.theme-toggle .icon-sun {
|
|
39
|
+
display: block;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.theme-toggle .icon-moon {
|
|
43
|
+
display: none;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.theme-toggle[data-theme='light'] .icon-sun {
|
|
47
|
+
display: none;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.theme-toggle[data-theme='light'] .icon-moon {
|
|
51
|
+
display: block;
|
|
52
|
+
}
|
|
53
|
+
|