elbe-ui 0.2.52 → 0.4.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 +12 -0
- package/dist/elbe.css +57 -56
- package/dist/elbe.css.map +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.js +6 -3
- package/dist/ui/components/banner.d.ts +3 -2
- package/dist/ui/components/banner.js +13 -7
- package/dist/ui/components/base/box.d.ts +7 -5
- package/dist/ui/components/base/card.d.ts +5 -1
- package/dist/ui/components/base/card.js +5 -1
- package/dist/ui/components/base/roles.d.ts +1 -0
- package/dist/ui/components/base/roles.js +1 -0
- package/dist/ui/components/button/button.d.ts +1 -0
- package/dist/ui/components/button/button.js +12 -4
- package/dist/ui/components/button/choose_button.js +3 -2
- package/dist/ui/components/button/icon_button.d.ts +3 -0
- package/dist/ui/components/button/icon_button.js +9 -2
- package/dist/ui/components/button/toggle_button.js +7 -1
- package/dist/ui/components/footer.d.ts +18 -0
- package/dist/ui/components/footer.js +35 -0
- package/dist/ui/components/input/checkbox.d.ts +2 -5
- package/dist/ui/components/input/checkbox.js +10 -19
- package/dist/ui/components/input/range.js +4 -1
- package/dist/ui/components/input/select.js +1 -1
- package/dist/ui/components/input/switch.d.ts +6 -2
- package/dist/ui/components/input/switch.js +25 -22
- package/dist/ui/components/input/text/input_field.d.ts +28 -0
- package/dist/ui/components/input/text/input_field.js +70 -0
- package/dist/ui/components/input/text/multi_line.d.ts +10 -0
- package/dist/ui/components/input/text/multi_line.js +19 -0
- package/dist/ui/components/input/text/single_line.d.ts +18 -0
- package/dist/ui/components/input/text/single_line.js +28 -0
- package/dist/ui/components/layout/app_base.d.ts +14 -0
- package/dist/ui/components/layout/app_base.js +30 -0
- package/dist/ui/components/layout/ctx_app_base.d.ts +16 -0
- package/dist/ui/components/layout/ctx_app_base.js +13 -0
- package/dist/ui/components/layout/flex.d.ts +4 -2
- package/dist/ui/components/layout/flex.js +13 -5
- package/dist/ui/components/layout/header.d.ts +18 -18
- package/dist/ui/components/layout/header.js +54 -48
- package/dist/ui/components/layout/menu.d.ts +12 -0
- package/dist/ui/components/layout/menu.js +56 -0
- package/dist/ui/components/layout/spaced.d.ts +4 -2
- package/dist/ui/components/layout/spaced.js +6 -2
- package/dist/ui/components/layout/toolbar.d.ts +7 -0
- package/dist/ui/components/layout/toolbar.js +71 -0
- package/dist/ui/components/link.d.ts +10 -0
- package/dist/ui/components/link.js +15 -0
- package/dist/ui/components/progress_bar.js +7 -5
- package/dist/ui/components/spinner.js +4 -0
- package/dist/ui/components/text.js +4 -4
- package/dist/ui/theme/color_theme.d.ts +1 -1
- package/dist/ui/theme/color_theme.js +63 -52
- package/dist/ui/theme/colors.d.ts +33 -13
- package/dist/ui/theme/colors.js +42 -15
- package/dist/ui/theme/geometry_theme.js +2 -4
- package/dist/ui/theme/seed.d.ts +18 -8
- package/dist/ui/theme/seed.js +4 -1
- package/dist/ui/theme/theme.d.ts +3 -5
- package/dist/ui/theme/theme.js +9 -12
- package/dist/ui/theme/theme_context.d.ts +18 -0
- package/dist/ui/theme/theme_context.js +26 -0
- package/dist/ui/theme/type_theme.js +5 -2
- package/dist/ui/util/ctx_toolbar.d.ts +8 -0
- package/dist/ui/util/ctx_toolbar.js +9 -0
- package/dist/ui/util/util.d.ts +6 -0
- package/dist/ui/util/util.js +35 -0
- package/package.json +1 -1
- package/dist/ui/components/input/input_field.d.ts +0 -22
- package/dist/ui/components/input/input_field.js +0 -36
- package/dist/ui/components/input/text_area.d.ts +0 -10
- package/dist/ui/components/input/text_area.js +0 -22
- package/dist/ui/components/layout/scaffold.d.ts +0 -15
- package/dist/ui/components/layout/scaffold.js +0 -31
package/README.md
CHANGED
|
@@ -34,3 +34,15 @@ as of now, this is mainly a personal project for different stuff I built. So thi
|
|
|
34
34
|
1. increment `version` number in `package.json`
|
|
35
35
|
2. run `bun run build`
|
|
36
36
|
3. run `npm publish`
|
|
37
|
+
|
|
38
|
+
- [x] contrast (test with WAVE, Axe)
|
|
39
|
+
- [x] dark mode
|
|
40
|
+
- [x] no color based differentiation
|
|
41
|
+
- [x] adjustable text size
|
|
42
|
+
- [x] adjustable UI size
|
|
43
|
+
- [x] responsive design
|
|
44
|
+
- [ ] label fields with `label` tag
|
|
45
|
+
- [ ] add `aria-*` attributes
|
|
46
|
+
- [ ] add `role` attributes
|
|
47
|
+
- [ ] add `tabindex` attributes
|
|
48
|
+
- [ ] force alt text for images
|
package/dist/elbe.css
CHANGED
|
@@ -88,17 +88,18 @@ body,
|
|
|
88
88
|
width: 1.2rem;
|
|
89
89
|
}
|
|
90
90
|
}*/
|
|
91
|
+
/*@keyframes toast_fadeOut {
|
|
92
|
+
from {
|
|
93
|
+
opacity: 1;
|
|
94
|
+
}
|
|
95
|
+
to {
|
|
96
|
+
opacity: 0;
|
|
97
|
+
}
|
|
98
|
+
}*/
|
|
91
99
|
}
|
|
92
100
|
.elbe .padded,
|
|
93
101
|
.elbe .card,
|
|
94
102
|
.elbe .toast,
|
|
95
|
-
.elbe input[type=text],
|
|
96
|
-
.elbe input[type=number],
|
|
97
|
-
.elbe input[type=password],
|
|
98
|
-
.elbe input[type=email],
|
|
99
|
-
.elbe input[type=date],
|
|
100
|
-
.elbe input[type=time],
|
|
101
|
-
.elbe textarea,
|
|
102
103
|
.elbe select,
|
|
103
104
|
.elbe button {
|
|
104
105
|
padding: var(--g-padding);
|
|
@@ -118,13 +119,6 @@ body,
|
|
|
118
119
|
.elbe .rounded,
|
|
119
120
|
.elbe .card,
|
|
120
121
|
.elbe .toast,
|
|
121
|
-
.elbe input[type=text],
|
|
122
|
-
.elbe input[type=number],
|
|
123
|
-
.elbe input[type=password],
|
|
124
|
-
.elbe input[type=email],
|
|
125
|
-
.elbe input[type=date],
|
|
126
|
-
.elbe input[type=time],
|
|
127
|
-
.elbe textarea,
|
|
128
122
|
.elbe select,
|
|
129
123
|
.elbe button {
|
|
130
124
|
border-radius: var(--g-radius);
|
|
@@ -171,16 +165,12 @@ body,
|
|
|
171
165
|
.elbe .disabled {
|
|
172
166
|
cursor: not-allowed;
|
|
173
167
|
}
|
|
168
|
+
.elbe .plain.disabled {
|
|
169
|
+
opacity: 0.5;
|
|
170
|
+
}
|
|
174
171
|
.elbe .box, .elbe .header, .elbe .base-limited,
|
|
175
172
|
.elbe .card,
|
|
176
173
|
.elbe .toast,
|
|
177
|
-
.elbe input[type=text],
|
|
178
|
-
.elbe input[type=number],
|
|
179
|
-
.elbe input[type=password],
|
|
180
|
-
.elbe input[type=email],
|
|
181
|
-
.elbe input[type=date],
|
|
182
|
-
.elbe input[type=time],
|
|
183
|
-
.elbe textarea,
|
|
184
174
|
.elbe select,
|
|
185
175
|
.elbe button {
|
|
186
176
|
border-style: solid;
|
|
@@ -237,7 +227,7 @@ body,
|
|
|
237
227
|
transform: rotate(359deg);
|
|
238
228
|
}
|
|
239
229
|
}
|
|
240
|
-
.elbe.
|
|
230
|
+
.elbe.highvis a {
|
|
241
231
|
text-decoration: underline;
|
|
242
232
|
}
|
|
243
233
|
.elbe a {
|
|
@@ -394,6 +384,13 @@ body,
|
|
|
394
384
|
.elbe .bordered.bordered.bordered {
|
|
395
385
|
border: var(--g-border-width) solid var(--c-context-border);
|
|
396
386
|
}
|
|
387
|
+
.elbe .no-scrollbar {
|
|
388
|
+
scrollbar-width: none; /* Firefox */
|
|
389
|
+
-ms-overflow-style: none; /* Internet Explorer and Edge */
|
|
390
|
+
}
|
|
391
|
+
.elbe .no-scrollbar::-webkit-scrollbar {
|
|
392
|
+
display: none; /* Safari and Chrome */
|
|
393
|
+
}
|
|
397
394
|
.elbe button {
|
|
398
395
|
justify-content: center;
|
|
399
396
|
padding: 0.25rem 0.75rem;
|
|
@@ -460,6 +457,7 @@ body,
|
|
|
460
457
|
}
|
|
461
458
|
.elbe dialog[open=""] > * {
|
|
462
459
|
display: unset;
|
|
460
|
+
max-width: 100vw;
|
|
463
461
|
}
|
|
464
462
|
.elbe .expandable {
|
|
465
463
|
max-height: 0px;
|
|
@@ -487,35 +485,20 @@ body,
|
|
|
487
485
|
justify-content: space-between;
|
|
488
486
|
align-items: center;
|
|
489
487
|
}
|
|
490
|
-
.elbe .frosted {
|
|
488
|
+
.elbe .frosted.frosted.frosted.frosted {
|
|
491
489
|
background-color: color-mix(in srgb, var(--c-context-back) 50%, transparent);
|
|
492
490
|
backdrop-filter: blur(10px);
|
|
493
491
|
-webkit-backdrop-filter: blur(10px);
|
|
494
492
|
}
|
|
495
|
-
.elbe
|
|
496
|
-
.
|
|
497
|
-
.elbe input[type=password],
|
|
498
|
-
.elbe input[type=email],
|
|
499
|
-
.elbe input[type=date],
|
|
500
|
-
.elbe input[type=time],
|
|
501
|
-
.elbe textarea {
|
|
502
|
-
padding: 0 0.75rem;
|
|
503
|
-
height: 3rem;
|
|
504
|
-
min-width: 12rem;
|
|
505
|
-
width: 100%;
|
|
506
|
-
}
|
|
507
|
-
.elbe textarea {
|
|
508
|
-
height: 6rem;
|
|
509
|
-
padding: 0.6rem 0.75rem;
|
|
510
|
-
resize: vertical;
|
|
511
|
-
min-height: 3rem;
|
|
493
|
+
.elbe .text_field_base:has(:focus) {
|
|
494
|
+
outline: max(2px, 0.15em) solid var(--c-accent);
|
|
512
495
|
}
|
|
513
|
-
.elbe.
|
|
496
|
+
.elbe.highvis input[type=range]::-webkit-slider-thumb {
|
|
514
497
|
border-width: var(--g-border-width);
|
|
515
498
|
border-style: solid;
|
|
516
499
|
border-color: var(--c-context-back);
|
|
517
500
|
}
|
|
518
|
-
.elbe.
|
|
501
|
+
.elbe.highvis input[type=range]::-moz-range-thumb {
|
|
519
502
|
border-width: var(--g-border-width);
|
|
520
503
|
border-style: solid;
|
|
521
504
|
border-color: var(--c-context-back);
|
|
@@ -525,7 +508,6 @@ body,
|
|
|
525
508
|
appearance: none;
|
|
526
509
|
width: 100%;
|
|
527
510
|
height: 0.4rem;
|
|
528
|
-
border-radius: 1rem;
|
|
529
511
|
background-color: var(--c-context-back);
|
|
530
512
|
outline: none;
|
|
531
513
|
-webkit-transition: 0.2s;
|
|
@@ -539,7 +521,7 @@ body,
|
|
|
539
521
|
appearance: none;
|
|
540
522
|
width: 1.5rem;
|
|
541
523
|
height: 1.5rem;
|
|
542
|
-
border-radius:
|
|
524
|
+
border-radius: var(--g-radius);
|
|
543
525
|
background: var(--c-context-front);
|
|
544
526
|
border: none;
|
|
545
527
|
outline: none;
|
|
@@ -548,7 +530,7 @@ body,
|
|
|
548
530
|
.elbe input[type=range]::-moz-range-thumb {
|
|
549
531
|
width: 1.5rem;
|
|
550
532
|
height: 1.5rem;
|
|
551
|
-
border-radius:
|
|
533
|
+
border-radius: var(--g-radius);
|
|
552
534
|
background: var(--c-context-front);
|
|
553
535
|
border: none;
|
|
554
536
|
outline: none;
|
|
@@ -578,6 +560,9 @@ body,
|
|
|
578
560
|
transform-origin: center;
|
|
579
561
|
transition: 0.2s all ease-in-out;
|
|
580
562
|
}
|
|
563
|
+
.elbe.reduced_motion input[type=checkbox]::before {
|
|
564
|
+
transition: none;
|
|
565
|
+
}
|
|
581
566
|
.elbe input[type=checkbox]:checked::before {
|
|
582
567
|
transform: scale(1);
|
|
583
568
|
background-color: var(--c-context-front);
|
|
@@ -590,7 +575,7 @@ body,
|
|
|
590
575
|
cursor: not-allowed;
|
|
591
576
|
border: 0.16em solid var(--c-context-border);
|
|
592
577
|
}
|
|
593
|
-
.elbe.
|
|
578
|
+
.elbe.highvis div[data-type=elbe_progress_bar] > * {
|
|
594
579
|
outline-width: var(--g-border-width);
|
|
595
580
|
outline-style: solid;
|
|
596
581
|
outline-color: var(--c-context-back);
|
|
@@ -600,17 +585,10 @@ body,
|
|
|
600
585
|
border-top: var(--g-border-width) solid var(--c-context-border);
|
|
601
586
|
width: 100%;
|
|
602
587
|
}
|
|
603
|
-
.elbe
|
|
604
|
-
|
|
588
|
+
.elbe button > * {
|
|
589
|
+
flex-shrink: 0;
|
|
605
590
|
}
|
|
606
|
-
.elbe
|
|
607
|
-
outline: none;
|
|
608
|
-
}
|
|
609
|
-
.elbe.dark :focus-visible {
|
|
610
|
-
outline: 0.15rem solid white;
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
.toast {
|
|
591
|
+
.elbe .toast {
|
|
614
592
|
position: fixed;
|
|
615
593
|
bottom: 1rem;
|
|
616
594
|
right: 1rem;
|
|
@@ -618,6 +596,29 @@ body,
|
|
|
618
596
|
left: 50%;
|
|
619
597
|
width: min(40rem, 90%);
|
|
620
598
|
transform: translateX(-50%);
|
|
599
|
+
animation: toast_fadeIn 0.2s ease-out;
|
|
600
|
+
}
|
|
601
|
+
.elbe.reduced_motion .toast {
|
|
602
|
+
animation: none;
|
|
603
|
+
}
|
|
604
|
+
@keyframes toast_fadeIn {
|
|
605
|
+
from {
|
|
606
|
+
opacity: 0;
|
|
607
|
+
transform: translateX(-50%) translateY(20px);
|
|
608
|
+
}
|
|
609
|
+
to {
|
|
610
|
+
opacity: 1;
|
|
611
|
+
transform: translateX(-50%) translateY(0);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
.elbe :focus-visible {
|
|
615
|
+
outline: 0.15rem solid var(--c-accent);
|
|
616
|
+
}
|
|
617
|
+
.elbe :active {
|
|
618
|
+
outline: none;
|
|
619
|
+
}
|
|
620
|
+
.elbe.dark :focus-visible {
|
|
621
|
+
outline: 0.15rem solid white;
|
|
621
622
|
}
|
|
622
623
|
|
|
623
624
|
/*# sourceMappingURL=elbe.css.map */
|
package/dist/elbe.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["../style/elbe.scss","../style/_base.scss","../style/_flex.scss","../style/_components.scss"],"names":[],"mappings":"AAAA;AAAA;AAAA;AAAA;AAOQ;AAMR;EACE;EACA;EACA;EACA;EAEA;EACA;EACA;EAGA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;;;AAGF;AAAA;AAAA;EAGE;EACA;EACA;EACA;EACA;;;AAGF;AAAA;EAEE;EACA;EACA;EACA;;;AAIF;AC3DA;AAoBA;
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../style/elbe.scss","../style/_base.scss","../style/_flex.scss","../style/_components.scss","../style/_toast.scss"],"names":[],"mappings":"AAAA;AAAA;AAAA;AAAA;AAOQ;AAMR;EACE;EACA;EACA;EACA;EAEA;EACA;EACA;EAGA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;;;AAGF;AAAA;AAAA;EAGE;EACA;EACA;EACA;EACA;;;AAGF;AAAA;EAEE;EACA;EACA;EACA;;;AAIF;AC3DA;AAoBA;AAiEA;AAUA;AAaA;AA8BA;AClHA;AAqBA;AAYA;AAkBA;AAqBA;ACkIA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACrME;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AH3BF;AAAA;AAAA;AAAA;AAAA;EAEE;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;;AAMF;EACE;;AAEF;AAAA;AAAA;AAAA;AAAA;EAEE;EACA;;AAGF;EACE;;AAGF;AAAA;EAEE;;AAGF;EACE;;AAEF;EACE;;AAGF;EACE;EACA;;AACA;EACE;;AAIJ;EACE;;AAGF;EACE;;AAEF;EACE;;AAEF;EACE;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;;AAKF;AAAA;AAAA;AAAA;AAAA;EAEE;EACA;;AAOF;EACE;;AAGF;EAEE;EACA;EACA;;AAKF;AAAA;EAEE;;AAEF;AAAA;AAAA;AAAA;EAEE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;EACA;;AAKF;EACE;EACA;EACA;EACA;;AAGF;EACE;IACE;;EAEF;IACE;;;AAKJ;EACE;;AAEF;EACE;;AACA;EACE;;ACnKJ;AAAA;AAAA;AAAA;AAAA;EAGE;EACA;EACA;EACA;;AAGF;EACE;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;;AAKF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAKF;EACE;;AAIA;EACE;;AADF;EACE;;AADF;EACE;;AADF;EACE;;AADF;EACE;;AADF;EACE;;AADF;EACE;;AADF;EACE;;AADF;EACE;;AADF;EACE;;AADF;EACE;;AADF;EACE;;AAMJ;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAKF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAKF;EACE;IACE;;EAGF;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;;;AAIJ;EACE;;ACvHF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EACE;EACA;EACA;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;EACA;;AAEA;EACE;;AAKJ;EAIE;EACA;EACA;EACA;EACA;EACA;EACA;AAMA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAJA;EACE;;AAoBJ;EACE;EACA;EACA;;AAGF;EAGE;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EAKE;EAEA;EACA;EACA;EACA;EACA;EAEA;EAEA;EAEA;EAEA;EACA;;AAEA;EACE;;AAGF;EACE;EACA;EACA;;AACA;EACE;EACA;;AAKN;EACE;EACA;EACA;;AAGF;EACE;EACA;;AAGF;EAGC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACC;EAGD;EAEA;EAEA;EACA;;AAGD;EACE;EACD;EACA;;AAgBD;EACE;;AAcA;EACE;EACA;EACA;;AAGF;EACE;EACA;EACA;;AAIJ;EACE;EACA;EACA;EACA;EAEA;EACA;EAEA;EACA;;AAEA;EACE;;AAGF;EACE;EACA;EAzCF;EACA;EACA;EACA;EACA;EACA;EACA;;AAuCA;EA7CA;EACA;EACA;EACA;EACA;EACA;EACA;;AAmFF;EACE;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EAEA;EACA;EACA;;AAIF;EACE;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAKF;EACE;EACA;EACA;;AAIF;EACE;EACA;EACA;;AAGF;EACE;;ACxUF;EAII;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAGF;EACE;IACE;IACA;;EAEF;IACE;IACA;;;AJyCJ;EACE;;AAEF;EACG;;AAGH;EACE","file":"elbe.css"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from "./bit/bit";
|
|
|
3
3
|
export * from "./bit/ctrl_bit";
|
|
4
4
|
export * from "./service/s_api";
|
|
5
5
|
export * from "./ui/util/confirm_dialog";
|
|
6
|
+
export * from "./ui/util/ctx_toolbar";
|
|
6
7
|
export * from "./ui/util/toast";
|
|
7
8
|
export * from "./ui/util/util";
|
|
8
9
|
export * from "./ui/components/base/box";
|
|
@@ -13,27 +14,29 @@ export * from "./ui/components/button/choose_button";
|
|
|
13
14
|
export * from "./ui/components/button/icon_button";
|
|
14
15
|
export * from "./ui/components/button/toggle_button";
|
|
15
16
|
export * from "./ui/components/layout/alignment";
|
|
17
|
+
export * from "./ui/components/layout/app_base";
|
|
16
18
|
export * from "./ui/components/layout/flex";
|
|
17
19
|
export * from "./ui/components/layout/header";
|
|
18
|
-
export * from "./ui/components/layout/scaffold";
|
|
19
20
|
export * from "./ui/components/layout/scroll";
|
|
20
21
|
export * from "./ui/components/layout/spaced";
|
|
21
22
|
export * from "./ui/components/input/checkbox";
|
|
22
|
-
export * from "./ui/components/input/input_field";
|
|
23
23
|
export * from "./ui/components/input/range";
|
|
24
24
|
export * from "./ui/components/input/select";
|
|
25
25
|
export * from "./ui/components/input/switch";
|
|
26
|
-
export * from "./ui/components/input/
|
|
26
|
+
export * from "./ui/components/input/text/input_field";
|
|
27
27
|
export * from "./ui/components/badge";
|
|
28
28
|
export * from "./ui/components/banner";
|
|
29
29
|
export * from "./ui/components/dialog";
|
|
30
30
|
export * from "./ui/components/error_view";
|
|
31
|
+
export * from "./ui/components/footer";
|
|
32
|
+
export * from "./ui/components/link";
|
|
31
33
|
export * from "./ui/components/progress_bar";
|
|
32
34
|
export * from "./ui/components/spinner";
|
|
33
35
|
export * from "./ui/components/text";
|
|
34
36
|
export * from "./ui/components/dev/todo";
|
|
35
37
|
export * from "./ui/theme/seed";
|
|
36
38
|
export * from "./ui/theme/theme";
|
|
39
|
+
export * from "./ui/theme/theme_context";
|
|
37
40
|
declare function None({}: {}): import("preact").JSX.Element;
|
|
38
41
|
export declare const Icons: {
|
|
39
42
|
None: typeof None;
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export * from "./bit/bit";
|
|
|
6
6
|
export * from "./bit/ctrl_bit";
|
|
7
7
|
export * from "./service/s_api";
|
|
8
8
|
export * from "./ui/util/confirm_dialog";
|
|
9
|
+
export * from "./ui/util/ctx_toolbar";
|
|
9
10
|
export * from "./ui/util/toast";
|
|
10
11
|
export * from "./ui/util/util";
|
|
11
12
|
export * from "./ui/components/base/box";
|
|
@@ -16,27 +17,29 @@ export * from "./ui/components/button/choose_button";
|
|
|
16
17
|
export * from "./ui/components/button/icon_button";
|
|
17
18
|
export * from "./ui/components/button/toggle_button";
|
|
18
19
|
export * from "./ui/components/layout/alignment";
|
|
20
|
+
export * from "./ui/components/layout/app_base";
|
|
19
21
|
export * from "./ui/components/layout/flex";
|
|
20
22
|
export * from "./ui/components/layout/header";
|
|
21
|
-
export * from "./ui/components/layout/scaffold";
|
|
22
23
|
export * from "./ui/components/layout/scroll";
|
|
23
24
|
export * from "./ui/components/layout/spaced";
|
|
24
25
|
export * from "./ui/components/input/checkbox";
|
|
25
|
-
export * from "./ui/components/input/input_field";
|
|
26
26
|
export * from "./ui/components/input/range";
|
|
27
27
|
export * from "./ui/components/input/select";
|
|
28
28
|
export * from "./ui/components/input/switch";
|
|
29
|
-
export * from "./ui/components/input/
|
|
29
|
+
export * from "./ui/components/input/text/input_field";
|
|
30
30
|
export * from "./ui/components/badge";
|
|
31
31
|
export * from "./ui/components/banner";
|
|
32
32
|
export * from "./ui/components/dialog";
|
|
33
33
|
export * from "./ui/components/error_view";
|
|
34
|
+
export * from "./ui/components/footer";
|
|
35
|
+
export * from "./ui/components/link";
|
|
34
36
|
export * from "./ui/components/progress_bar";
|
|
35
37
|
export * from "./ui/components/spinner";
|
|
36
38
|
export * from "./ui/components/text";
|
|
37
39
|
export * from "./ui/components/dev/todo";
|
|
38
40
|
export * from "./ui/theme/seed";
|
|
39
41
|
export * from "./ui/theme/theme";
|
|
42
|
+
export * from "./ui/theme/theme_context";
|
|
40
43
|
function None({}) {
|
|
41
44
|
return _jsx("div", { style: { width: "1.5rem", height: "1.5rem" } });
|
|
42
45
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ElbeAlertKinds, IconChild } from "../..";
|
|
2
|
-
export declare function KindAlertIcon({ kind }: {
|
|
2
|
+
export declare function KindAlertIcon({ kind, size, }: {
|
|
3
3
|
kind: ElbeAlertKinds;
|
|
4
|
-
|
|
4
|
+
size?: "body-s" | "body-m" | "body-l";
|
|
5
|
+
}): any;
|
|
5
6
|
export declare function Banner({ kind, manner, title, onDismiss, dismissIcon, children, }: {
|
|
6
7
|
kind: ElbeAlertKinds;
|
|
7
8
|
manner?: "major" | "minor";
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { AlertTriangleIcon, CheckCircle2Icon, CircleHelpIcon, InfoIcon, OctagonAlertIcon, XIcon, } from "lucide-react";
|
|
3
3
|
import { Align, Card, Column, IconButton, Row, Text, } from "../..";
|
|
4
|
-
export function KindAlertIcon({ kind }) {
|
|
4
|
+
export function KindAlertIcon({ kind, size = "body-m", }) {
|
|
5
|
+
let icon = CircleHelpIcon;
|
|
5
6
|
if (kind === "info")
|
|
6
|
-
|
|
7
|
+
icon = InfoIcon;
|
|
7
8
|
if (kind === "warning")
|
|
8
|
-
|
|
9
|
+
icon = AlertTriangleIcon;
|
|
9
10
|
if (kind === "error")
|
|
10
|
-
|
|
11
|
+
icon = OctagonAlertIcon;
|
|
11
12
|
if (kind === "success")
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
icon = CheckCircle2Icon;
|
|
14
|
+
let scale = 1;
|
|
15
|
+
if (size === "body-s")
|
|
16
|
+
scale = 0.8;
|
|
17
|
+
if (size === "body-l")
|
|
18
|
+
scale = 1.2;
|
|
19
|
+
return icon({ size: `${scale * 1.5}rem` });
|
|
14
20
|
}
|
|
15
21
|
export function Banner({ kind, manner = "major", title, onDismiss, dismissIcon = XIcon, children, }) {
|
|
16
22
|
return (_jsx(Card, { kind: kind, manner: manner, padding: 0, children: _jsxs(Row, { cross: "start", gap: 0, children: [_jsx(Align, { size: 3, children: _jsx(KindAlertIcon, { kind: kind }) }), _jsxs(Column, { gap: 0.5, class: "flex-1", style: { padding: ".9rem 0", paddingRight: onDismiss ? "0" : "1rem" }, children: [title && _jsx(Text, { bold: true, v: title }), children] }), onDismiss && (_jsx(IconButton, { manner: manner, kind: kind, transparent: manner === "minor", ariaLabel: "close", icon: dismissIcon, onTap: onDismiss }))] }) }));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Component } from "preact";
|
|
2
2
|
import type { ElbeColorModes, ElbeColorSchemes } from "../../theme/colors";
|
|
3
3
|
import type { ElbeChildren } from "../../util/util";
|
|
4
|
+
import { AriaRoles } from "./roles";
|
|
4
5
|
export type ElbeProps = {
|
|
5
6
|
id?: string;
|
|
6
7
|
class?: string;
|
|
@@ -9,6 +10,7 @@ export type ElbeProps = {
|
|
|
9
10
|
flex?: boolean | number;
|
|
10
11
|
typeLabel?: string;
|
|
11
12
|
ariaLabel?: string | null;
|
|
13
|
+
role?: AriaRoles | null;
|
|
12
14
|
};
|
|
13
15
|
export type ActionElbeProps = ElbeProps & {
|
|
14
16
|
ariaLabel: string | null;
|
|
@@ -29,6 +31,7 @@ export declare function applyProps(typeLabel: string, p: ElbeProps, classes?: st
|
|
|
29
31
|
marker?: string | number | null | undefined;
|
|
30
32
|
mask?: string | number | null | undefined;
|
|
31
33
|
font?: string | number | null | undefined;
|
|
34
|
+
resize?: string | number | null | undefined;
|
|
32
35
|
border?: string | number | null | undefined;
|
|
33
36
|
accentColor?: string | number | null | undefined;
|
|
34
37
|
alignContent?: string | number | null | undefined;
|
|
@@ -342,7 +345,6 @@ export declare function applyProps(typeLabel: string, p: ElbeProps, classes?: st
|
|
|
342
345
|
printColorAdjust?: string | number | null | undefined;
|
|
343
346
|
quotes?: string | number | null | undefined;
|
|
344
347
|
r?: string | number | null | undefined;
|
|
345
|
-
resize?: string | number | null | undefined;
|
|
346
348
|
right?: string | number | null | undefined;
|
|
347
349
|
rotate?: string | number | null | undefined;
|
|
348
350
|
rowGap?: string | number | null | undefined;
|
|
@@ -548,6 +550,7 @@ export declare class Box extends Component<ElbeBoxProps & {
|
|
|
548
550
|
marker?: string | number | null | undefined;
|
|
549
551
|
mask?: string | number | null | undefined;
|
|
550
552
|
font?: string | number | null | undefined;
|
|
553
|
+
resize?: string | number | null | undefined;
|
|
551
554
|
border?: string | number | null | undefined;
|
|
552
555
|
accentColor?: string | number | null | undefined;
|
|
553
556
|
alignContent?: string | number | null | undefined;
|
|
@@ -861,7 +864,6 @@ export declare class Box extends Component<ElbeBoxProps & {
|
|
|
861
864
|
printColorAdjust?: string | number | null | undefined;
|
|
862
865
|
quotes?: string | number | null | undefined;
|
|
863
866
|
r?: string | number | null | undefined;
|
|
864
|
-
resize?: string | number | null | undefined;
|
|
865
867
|
right?: string | number | null | undefined;
|
|
866
868
|
rotate?: string | number | null | undefined;
|
|
867
869
|
rowGap?: string | number | null | undefined;
|
|
@@ -1058,6 +1060,7 @@ export declare class Box extends Component<ElbeBoxProps & {
|
|
|
1058
1060
|
marker?: string | number | null | undefined;
|
|
1059
1061
|
mask?: string | number | null | undefined;
|
|
1060
1062
|
font?: string | number | null | undefined;
|
|
1063
|
+
resize?: string | number | null | undefined;
|
|
1061
1064
|
border?: string | number | null | undefined;
|
|
1062
1065
|
accentColor?: string | number | null | undefined;
|
|
1063
1066
|
alignContent?: string | number | null | undefined;
|
|
@@ -1371,7 +1374,6 @@ export declare class Box extends Component<ElbeBoxProps & {
|
|
|
1371
1374
|
printColorAdjust?: string | number | null | undefined;
|
|
1372
1375
|
quotes?: string | number | null | undefined;
|
|
1373
1376
|
r?: string | number | null | undefined;
|
|
1374
|
-
resize?: string | number | null | undefined;
|
|
1375
1377
|
right?: string | number | null | undefined;
|
|
1376
1378
|
rotate?: string | number | null | undefined;
|
|
1377
1379
|
rowGap?: string | number | null | undefined;
|
|
@@ -1568,6 +1570,7 @@ export declare class Box extends Component<ElbeBoxProps & {
|
|
|
1568
1570
|
marker?: string | number | null | undefined;
|
|
1569
1571
|
mask?: string | number | null | undefined;
|
|
1570
1572
|
font?: string | number | null | undefined;
|
|
1573
|
+
resize?: string | number | null | undefined;
|
|
1571
1574
|
border?: string | number | null | undefined;
|
|
1572
1575
|
accentColor?: string | number | null | undefined;
|
|
1573
1576
|
alignContent?: string | number | null | undefined;
|
|
@@ -1881,7 +1884,6 @@ export declare class Box extends Component<ElbeBoxProps & {
|
|
|
1881
1884
|
printColorAdjust?: string | number | null | undefined;
|
|
1882
1885
|
quotes?: string | number | null | undefined;
|
|
1883
1886
|
r?: string | number | null | undefined;
|
|
1884
|
-
resize?: string | number | null | undefined;
|
|
1885
1887
|
right?: string | number | null | undefined;
|
|
1886
1888
|
rotate?: string | number | null | undefined;
|
|
1887
1889
|
rowGap?: string | number | null | undefined;
|
|
@@ -2078,6 +2080,7 @@ export declare class Box extends Component<ElbeBoxProps & {
|
|
|
2078
2080
|
marker?: string | number | null | undefined;
|
|
2079
2081
|
mask?: string | number | null | undefined;
|
|
2080
2082
|
font?: string | number | null | undefined;
|
|
2083
|
+
resize?: string | number | null | undefined;
|
|
2081
2084
|
border?: string | number | null | undefined;
|
|
2082
2085
|
accentColor?: string | number | null | undefined;
|
|
2083
2086
|
alignContent?: string | number | null | undefined;
|
|
@@ -2391,7 +2394,6 @@ export declare class Box extends Component<ElbeBoxProps & {
|
|
|
2391
2394
|
printColorAdjust?: string | number | null | undefined;
|
|
2392
2395
|
quotes?: string | number | null | undefined;
|
|
2393
2396
|
r?: string | number | null | undefined;
|
|
2394
|
-
resize?: string | number | null | undefined;
|
|
2395
2397
|
right?: string | number | null | undefined;
|
|
2396
2398
|
rotate?: string | number | null | undefined;
|
|
2397
2399
|
rowGap?: string | number | null | undefined;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ElbeColorKinds, ElbeColorManners, ElbeColorModes, ElbeColorSchemes } from "../../theme/colors";
|
|
2
2
|
import type { ElbeChildren } from "../../util/util";
|
|
3
3
|
import { type ElbeProps } from "./box";
|
|
4
|
-
export declare
|
|
4
|
+
export declare const elevatedShadow = "0 0 15px rgba(0,0,0,.2)";
|
|
5
|
+
export declare function Card({ mode, scheme, kind, manner, padding, margin, onTap, onLongTap, frosted, bordered, elevated, sharp, disabled, overflow, children, ...elbe }: {
|
|
5
6
|
mode?: ElbeColorModes;
|
|
6
7
|
scheme?: ElbeColorSchemes;
|
|
7
8
|
kind?: ElbeColorKinds;
|
|
@@ -11,7 +12,10 @@ export declare function Card({ mode, scheme, kind, manner, padding, margin, onTa
|
|
|
11
12
|
onTap?: () => void;
|
|
12
13
|
onLongTap?: () => void;
|
|
13
14
|
frosted?: boolean;
|
|
15
|
+
elevated?: boolean;
|
|
14
16
|
bordered?: boolean;
|
|
15
17
|
sharp?: boolean;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
overflow?: "hidden" | "scroll" | "auto";
|
|
16
20
|
children?: ElbeChildren;
|
|
17
21
|
} & ElbeProps): import("preact").JSX.Element;
|
|
@@ -11,8 +11,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "preact/jsx-runtime";
|
|
13
13
|
import { applyProps } from "./box";
|
|
14
|
+
export const elevatedShadow = "0 0 15px rgba(0,0,0,.2)";
|
|
14
15
|
export function Card(_a) {
|
|
15
|
-
var { mode, scheme = "primary", kind, manner, padding = 1, margin = 0, onTap, onLongTap, frosted, bordered, sharp, children } = _a, elbe = __rest(_a, ["mode", "scheme", "kind", "manner", "padding", "margin", "onTap", "onLongTap", "frosted", "bordered", "sharp", "children"]);
|
|
16
|
+
var { mode, scheme = "primary", kind, manner, padding = 1, margin = 0, onTap, onLongTap, frosted, bordered, elevated, sharp, disabled, overflow, children } = _a, elbe = __rest(_a, ["mode", "scheme", "kind", "manner", "padding", "margin", "onTap", "onLongTap", "frosted", "bordered", "elevated", "sharp", "disabled", "overflow", "children"]);
|
|
16
17
|
return (_jsx("div", Object.assign({}, applyProps("card", elbe, [
|
|
17
18
|
"card",
|
|
18
19
|
mode,
|
|
@@ -22,8 +23,11 @@ export function Card(_a) {
|
|
|
22
23
|
frosted && "frosted",
|
|
23
24
|
bordered && "bordered",
|
|
24
25
|
sharp && "sharp",
|
|
26
|
+
disabled && "disabled",
|
|
25
27
|
], {
|
|
26
28
|
padding: `${padding}rem`,
|
|
27
29
|
margin: `${margin}rem`,
|
|
30
|
+
overflow: overflow,
|
|
31
|
+
boxShadow: elevated ? elevatedShadow : undefined,
|
|
28
32
|
}), { onClick: onTap, onContextMenu: onLongTap, children: children })));
|
|
29
33
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type AriaRoles = "alert" | "alertdialog" | "application" | "article" | "banner" | "button" | "cell" | "checkbox" | "columnheader" | "combobox" | "complementary" | "contentinfo" | "definition" | "dialog" | "directory" | "document" | "feed" | "figure" | "form" | "grid" | "gridcell" | "group" | "heading" | "img" | "link" | "list" | "listbox" | "listitem" | "log" | "main" | "marquee" | "math" | "menu" | "menubar" | "menuitem" | "menuitemcheckbox" | "menuitemradio" | "navigation" | "none" | "note" | "option" | "presentation" | "progressbar" | "radio" | "radiogroup" | "region" | "row" | "rowgroup" | "rowheader" | "scrollbar" | "search" | "searchbox" | "separator" | "slider" | "spinbutton" | "status" | "switch" | "tab" | "table" | "tablist" | "tabpanel" | "term" | "textbox" | "timer" | "toolbar" | "tooltip" | "tree" | "treegrid" | "treeitem";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -11,6 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
13
13
|
import { Component } from "preact";
|
|
14
|
+
import { useToolbar } from "../../util/ctx_toolbar";
|
|
14
15
|
import { _ElbeErr } from "../../util/error_view";
|
|
15
16
|
import { applyProps } from "../base/box";
|
|
16
17
|
export class Button extends Component {
|
|
@@ -23,15 +24,22 @@ Button.minor = (p) => _btn(p, "minor");
|
|
|
23
24
|
Button.flat = (p) => _btn(p, "flat");
|
|
24
25
|
Button.plain = (p) => _btn(p, "plain");
|
|
25
26
|
function _btn(_a, manner) {
|
|
26
|
-
var
|
|
27
|
-
|
|
27
|
+
var _b;
|
|
28
|
+
var { kind, onTap, icon, label, children, contentAlign } = _a, elbe = __rest(_a, ["kind", "onTap", "icon", "label", "children", "contentAlign"]);
|
|
29
|
+
const toolbarCtx = useToolbar();
|
|
30
|
+
return label || icon || children ? (_jsxs("button", Object.assign({}, applyProps("button", Object.assign(Object.assign({ role: "button" }, elbe), { flex: (toolbarCtx === null || toolbarCtx === void 0 ? void 0 : toolbarCtx.isInOverflow) ? 1 : elbe.flex }), [
|
|
28
31
|
"row",
|
|
29
32
|
"gap-half",
|
|
30
|
-
"main-center",
|
|
31
33
|
kind !== null && kind !== void 0 ? kind : (manner != "plain" && "accent"),
|
|
32
34
|
manner,
|
|
33
35
|
!onTap && "disabled",
|
|
34
36
|
], {
|
|
37
|
+
overflow: "hidden",
|
|
38
|
+
justifyContent: contentAlign !== null && contentAlign !== void 0 ? contentAlign : ((toolbarCtx === null || toolbarCtx === void 0 ? void 0 : toolbarCtx.isInOverflow) ? "start" : "center"),
|
|
35
39
|
backgroundColor: elbe.transparent ? "transparent" : null,
|
|
36
|
-
}), { disabled: !onTap, onClick: (e) => onTap && onTap(e), children: [typeof icon === "function" ? icon({}) : icon,
|
|
40
|
+
}), { title: (_b = elbe.ariaLabel) !== null && _b !== void 0 ? _b : label, disabled: !onTap, onClick: (e) => onTap && onTap(e), children: [typeof icon === "function" ? icon({}) : icon, !(toolbarCtx === null || toolbarCtx === void 0 ? void 0 : toolbarCtx.isInToolbar) && label && (_jsx("div", { style: {
|
|
41
|
+
whiteSpace: "nowrap",
|
|
42
|
+
overflow: "hidden",
|
|
43
|
+
textOverflow: "ellipsis",
|
|
44
|
+
}, children: label })), children] }))) : (_ElbeErr("Button requires either an icon and or a label, or a child"));
|
|
37
45
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
2
|
import { CheckIcon } from "lucide-react";
|
|
3
|
+
import { Card } from "../base/card";
|
|
3
4
|
import { Spaced } from "../layout/spaced";
|
|
4
5
|
import { Button } from "./button";
|
|
5
6
|
export function ChooseButton({ items, value, onChange, kind, column = false, }) {
|
|
6
|
-
return (_jsx(
|
|
7
|
+
return (_jsx(Card, { kind: "accent", manner: "major", padding: 0, overflow: "hidden", role: "radiogroup", disabled: !onChange, class: `${column ? "column" : "row"} gap-none`, children: items.map((e) => {
|
|
7
8
|
var _a, _b;
|
|
8
|
-
return (_jsxs(Button, { ariaLabel: (_b = (_a = e.ariaLabel) !== null && _a !== void 0 ? _a : e.label) !== null && _b !== void 0 ? _b : null, manner: e.value === value ? "
|
|
9
|
+
return (_jsxs(Button, { ariaLabel: (_b = (_a = e.ariaLabel) !== null && _a !== void 0 ? _a : e.label) !== null && _b !== void 0 ? _b : null, manner: e.value === value ? "major" : "flat", kind: kind, onTap: onChange && (() => onChange(e.value)), class: `sharp ${column ? "main-between gap-double" : ""}`, children: [_jsxs("div", { class: "row gap-half", children: [typeof e.icon === "function" ? e.icon({}) : e.icon, e.label && _jsx("span", { children: e.label })] }), column &&
|
|
9
10
|
(e.value === value ? _jsx(CheckIcon, {}) : _jsx(Spaced, { amount: 1.5 }))] }));
|
|
10
11
|
}) }));
|
|
11
12
|
}
|
|
@@ -16,3 +16,6 @@ export declare class IconButton extends Component<IconButtonProps & {
|
|
|
16
16
|
static plain: (p: IconButtonProps) => import("preact").JSX.Element;
|
|
17
17
|
render(): import("preact").JSX.Element;
|
|
18
18
|
}
|
|
19
|
+
export declare function _IconChild(p: {
|
|
20
|
+
icon: IconChild | null;
|
|
21
|
+
}): any;
|
|
@@ -22,7 +22,7 @@ IconButton.minor = (p) => _btn(p, "minor");
|
|
|
22
22
|
IconButton.flat = (p) => _btn(p, "flat");
|
|
23
23
|
IconButton.plain = (p) => _btn(p, "plain");
|
|
24
24
|
function _btn(_a, manner) {
|
|
25
|
-
var _b;
|
|
25
|
+
var _b, _c;
|
|
26
26
|
var { icon, onTap } = _a, elbe = __rest(_a, ["icon", "onTap"]);
|
|
27
27
|
if (manner === void 0) { manner = "major"; }
|
|
28
28
|
return (_jsx("button", Object.assign({}, applyProps("icon_button", elbe, [
|
|
@@ -38,5 +38,12 @@ function _btn(_a, manner) {
|
|
|
38
38
|
borderRadius: "3rem",
|
|
39
39
|
height: "3rem",
|
|
40
40
|
width: "3rem",
|
|
41
|
-
}), { onClick: (e) => onTap && onTap(e), children:
|
|
41
|
+
}), { title: (_c = elbe.ariaLabel) !== null && _c !== void 0 ? _c : undefined, onClick: (e) => onTap && onTap(e), children: _jsx(_IconChild, { icon: icon }) })));
|
|
42
|
+
}
|
|
43
|
+
export function _IconChild(p) {
|
|
44
|
+
if (!p.icon)
|
|
45
|
+
return null;
|
|
46
|
+
if (typeof p.icon === "function")
|
|
47
|
+
return p.icon({});
|
|
48
|
+
return p.icon;
|
|
42
49
|
}
|
|
@@ -11,10 +11,16 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
13
13
|
import { CheckIcon } from "lucide-react";
|
|
14
|
+
import { useThemeConfig } from "../../theme/theme_context";
|
|
14
15
|
import { applyProps } from "../base/box";
|
|
16
|
+
import { Padded } from "../base/padded";
|
|
15
17
|
import { Spaced } from "../layout/spaced";
|
|
16
18
|
import { Button } from "./button";
|
|
17
19
|
export function ToggleButton(_a) {
|
|
18
20
|
var { value, onChange, label, icon, kind } = _a, elbe = __rest(_a, ["value", "onChange", "label", "icon", "kind"]);
|
|
19
|
-
|
|
21
|
+
const tConfig = useThemeConfig();
|
|
22
|
+
return (_jsxs(Button, Object.assign({ manner: value ? "major" : "flat", kind: kind, onTap: onChange && (() => onChange(!value)) }, applyProps("toggle_button", elbe, "main-between"), { children: [_jsxs("div", { class: "row gap-none", children: [typeof icon === "function" ? icon({}) : icon, icon && _jsx(Spaced, { width: 0.5 }), label && _jsx("span", { children: label })] }), _jsx("div", { style: {
|
|
23
|
+
transition: tConfig.reducedMotion ? null : "width 0.2s ease-in-out",
|
|
24
|
+
width: value ? "2.5rem" : "0rem",
|
|
25
|
+
}, children: value && (_jsx(Padded, { class: "centered", left: 1, children: _jsx(CheckIcon, {}) })) })] })));
|
|
20
26
|
}
|