basecoat-css 1.0.0-beta.7 → 1.0.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/LICENSE.md +21 -0
- package/README.md +82 -35
- package/dist/base/base.css +3 -45
- package/dist/basecoat-base.cdn.css +61 -22
- package/dist/basecoat-base.cdn.min.css +1 -1
- package/dist/basecoat-compat.cdn.css +16 -20
- package/dist/basecoat-compat.cdn.min.css +1 -1
- package/dist/basecoat-components.css +1 -0
- package/dist/basecoat-luma.cdn.css +130 -92
- package/dist/basecoat-luma.cdn.min.css +1 -1
- package/dist/basecoat-lyra.cdn.css +135 -96
- package/dist/basecoat-lyra.cdn.min.css +1 -1
- package/dist/basecoat-maia.cdn.css +123 -85
- package/dist/basecoat-maia.cdn.min.css +1 -1
- package/dist/basecoat-mira.cdn.css +133 -95
- package/dist/basecoat-mira.cdn.min.css +1 -1
- package/dist/basecoat-nova.cdn.css +135 -96
- package/dist/basecoat-nova.cdn.min.css +1 -1
- package/dist/basecoat-rhea.cdn.css +130 -92
- package/dist/basecoat-rhea.cdn.min.css +1 -1
- package/dist/basecoat-sera.cdn.css +110 -71
- package/dist/basecoat-sera.cdn.min.css +1 -1
- package/dist/basecoat-vega.cdn.css +131 -92
- package/dist/basecoat-vega.cdn.min.css +1 -1
- package/dist/basecoat.cdn.css +131 -92
- package/dist/basecoat.cdn.min.css +1 -1
- package/dist/compat/legacy.css +19 -1
- package/dist/components/input-group.css +1 -1
- package/dist/components/scrollbar.css +46 -0
- package/dist/components/select.css +16 -16
- package/dist/styles/luma.css +15 -15
- package/dist/styles/lyra.css +14 -14
- package/dist/styles/maia.css +15 -15
- package/dist/styles/mira.css +16 -16
- package/dist/styles/nova.css +14 -14
- package/dist/styles/rhea.css +15 -15
- package/dist/styles/sera.css +16 -16
- package/dist/styles/vega.css +14 -14
- package/package.json +26 -6
- package/templates/jinja/combobox.html.jinja +147 -0
- package/templates/jinja/command.html.jinja +210 -0
- package/templates/jinja/dialog.html.jinja +97 -0
- package/templates/jinja/dropdown-menu.html.jinja +130 -0
- package/templates/jinja/popover.html.jinja +51 -0
- package/templates/jinja/select.html.jinja +191 -0
- package/templates/jinja/sidebar.html.jinja +149 -0
- package/templates/jinja/tabs.html.jinja +82 -0
- package/templates/jinja/toast.html.jinja +139 -0
- package/templates/nunjucks/combobox.njk +157 -0
- package/templates/nunjucks/command.njk +203 -0
- package/templates/nunjucks/dialog.njk +92 -0
- package/templates/nunjucks/dropdown-menu.njk +125 -0
- package/templates/nunjucks/popover.njk +48 -0
- package/templates/nunjucks/select.njk +184 -0
- package/templates/nunjucks/sidebar.njk +144 -0
- package/templates/nunjucks/tabs.njk +39 -0
- package/templates/nunjucks/toast.njk +137 -0
package/dist/styles/rhea.css
CHANGED
|
@@ -480,51 +480,51 @@
|
|
|
480
480
|
@apply mb-1 w-full;
|
|
481
481
|
}
|
|
482
482
|
/* Select */
|
|
483
|
-
|
|
483
|
+
.select:not(select) > button {
|
|
484
484
|
@apply bg-input/50 border-transparent focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 h-8 data-[size=sm]:h-7 gap-1.5 rounded-2xl border px-3 py-2 text-sm transition-[color,box-shadow] duration-200 focus-visible:ring-3 aria-invalid:ring-3 [&_svg:not([class*='size-'])]:size-4;
|
|
485
485
|
}
|
|
486
486
|
|
|
487
|
-
|
|
487
|
+
.select:not(select) > button > span {
|
|
488
488
|
@apply gap-1.5;
|
|
489
489
|
}
|
|
490
490
|
|
|
491
|
-
|
|
491
|
+
.select:not(select) > button > svg {
|
|
492
492
|
@apply text-muted-foreground size-4;
|
|
493
493
|
}
|
|
494
494
|
|
|
495
|
-
|
|
495
|
+
.select:not(select) [data-popover] {
|
|
496
496
|
@apply bg-popover text-popover-foreground ring-foreground/5 dark:ring-foreground/10 rounded-2xl p-1 shadow-lg ring-1 duration-100;
|
|
497
497
|
}
|
|
498
498
|
|
|
499
499
|
|
|
500
500
|
|
|
501
501
|
|
|
502
|
-
|
|
502
|
+
.select:not(select) [role='listbox'] {
|
|
503
503
|
@apply scroll-py-1.5;
|
|
504
504
|
}
|
|
505
505
|
|
|
506
|
-
|
|
506
|
+
.select:not(select) [role='listbox']:not(:has([data-value]:not([aria-hidden='true'])))::before {
|
|
507
507
|
@apply py-6 text-center text-sm;
|
|
508
508
|
}
|
|
509
509
|
|
|
510
|
-
|
|
510
|
+
.select:not(select) [role='heading'] {
|
|
511
511
|
@apply text-muted-foreground px-2 py-1 text-xs;
|
|
512
512
|
}
|
|
513
513
|
|
|
514
|
-
|
|
514
|
+
.select:not(select) [role='option'] {
|
|
515
515
|
@apply min-h-7 gap-2 rounded-xl py-1.5 ps-2 pe-8 text-sm [&_svg:not([class*='size-'])]:size-4;
|
|
516
516
|
}
|
|
517
517
|
|
|
518
|
-
|
|
519
|
-
|
|
518
|
+
.select:not(select) [role='option'].active,
|
|
519
|
+
.select:not(select) [role='option']:focus-visible {
|
|
520
520
|
@apply bg-muted text-foreground [&_svg]:text-foreground;
|
|
521
521
|
}
|
|
522
522
|
|
|
523
|
-
|
|
523
|
+
.select:not(select) [role='group'] {
|
|
524
524
|
@apply scroll-my-1.5 p-1;
|
|
525
525
|
}
|
|
526
526
|
|
|
527
|
-
|
|
527
|
+
.select:not(select) [role='separator'] {
|
|
528
528
|
@apply bg-border -mx-1 my-1 h-px;
|
|
529
529
|
}
|
|
530
530
|
|
|
@@ -595,7 +595,7 @@
|
|
|
595
595
|
}
|
|
596
596
|
|
|
597
597
|
.drawer > * {
|
|
598
|
-
@apply before:bg-popover before:border-border
|
|
598
|
+
@apply before:bg-popover before:border-border bg-transparent p-4 text-sm before:absolute before:inset-2 before:-z-10 before:rounded-[min(var(--radius-4xl),24px)] before:border before:shadow-xl;
|
|
599
599
|
}
|
|
600
600
|
|
|
601
601
|
.drawer > * > header {
|
|
@@ -803,11 +803,11 @@
|
|
|
803
803
|
@apply bg-background rounded-2xl shadow-sm not-dark:bg-clip-padding;
|
|
804
804
|
}
|
|
805
805
|
|
|
806
|
-
.dark :is(.field > input[type='checkbox'][role='switch'], .input[type='checkbox'][role='switch']):not(:checked):before {
|
|
806
|
+
html.dark :is(.field > input[type='checkbox'][role='switch'], .input[type='checkbox'][role='switch']):not(:checked):before {
|
|
807
807
|
@apply bg-foreground;
|
|
808
808
|
}
|
|
809
809
|
|
|
810
|
-
.dark :is(.field > input[type='checkbox'][role='switch'], .input[type='checkbox'][role='switch']):checked:before {
|
|
810
|
+
html.dark :is(.field > input[type='checkbox'][role='switch'], .input[type='checkbox'][role='switch']):checked:before {
|
|
811
811
|
@apply bg-primary-foreground;
|
|
812
812
|
}
|
|
813
813
|
|
package/dist/styles/sera.css
CHANGED
|
@@ -361,11 +361,11 @@
|
|
|
361
361
|
|
|
362
362
|
/* Command */
|
|
363
363
|
.command {
|
|
364
|
-
@apply bg-popover text-popover-foreground rounded-none
|
|
364
|
+
@apply bg-popover text-popover-foreground rounded-none!;
|
|
365
365
|
}
|
|
366
366
|
|
|
367
367
|
.command-dialog > .command {
|
|
368
|
-
@apply bg-popover text-popover-foreground ring-foreground/10 rounded-none shadow-md ring-1 duration-100;
|
|
368
|
+
@apply bg-popover text-popover-foreground ring-foreground/10 rounded-none! shadow-md ring-1 duration-100;
|
|
369
369
|
}
|
|
370
370
|
|
|
371
371
|
.command > header {
|
|
@@ -484,51 +484,51 @@
|
|
|
484
484
|
@apply mb-1 w-full;
|
|
485
485
|
}
|
|
486
486
|
/* Select */
|
|
487
|
-
|
|
487
|
+
.select:not(select) > button {
|
|
488
488
|
@apply border-transparent border-b-input bg-transparent focus-visible:border-b-ring aria-invalid:border-b-destructive dark:aria-invalid:border-b-destructive/50 h-10 data-[size=sm]:h-9 gap-1.5 rounded-none border px-0 py-2 text-sm transition-[color,border-color] [&_svg:not([class*='size-'])]:size-3.5;
|
|
489
489
|
}
|
|
490
490
|
|
|
491
|
-
|
|
491
|
+
.select:not(select) > button > span {
|
|
492
492
|
@apply gap-1.5;
|
|
493
493
|
}
|
|
494
494
|
|
|
495
|
-
|
|
495
|
+
.select:not(select) > button > svg {
|
|
496
496
|
@apply text-muted-foreground size-3.5;
|
|
497
497
|
}
|
|
498
498
|
|
|
499
|
-
|
|
499
|
+
.select:not(select) [data-popover] {
|
|
500
500
|
@apply bg-popover text-popover-foreground ring-foreground/10 rounded-none p-1.5 shadow-md ring-1 duration-100;
|
|
501
501
|
}
|
|
502
502
|
|
|
503
503
|
|
|
504
504
|
|
|
505
505
|
|
|
506
|
-
|
|
506
|
+
.select:not(select) [role='listbox'] {
|
|
507
507
|
@apply scroll-py-1.5;
|
|
508
508
|
}
|
|
509
509
|
|
|
510
|
-
|
|
510
|
+
.select:not(select) [role='listbox']:not(:has([data-value]:not([aria-hidden='true'])))::before {
|
|
511
511
|
@apply py-6 text-center text-sm;
|
|
512
512
|
}
|
|
513
513
|
|
|
514
|
-
|
|
514
|
+
.select:not(select) [role='heading'] {
|
|
515
515
|
@apply px-3 py-2 text-xs font-semibold tracking-wider text-muted-foreground uppercase;
|
|
516
516
|
}
|
|
517
517
|
|
|
518
|
-
|
|
518
|
+
.select:not(select) [role='option'] {
|
|
519
519
|
@apply gap-2.5 rounded-none py-2 ps-3 pe-8 text-sm [&_svg:not([class*='size-'])]:size-3.5;
|
|
520
520
|
}
|
|
521
521
|
|
|
522
|
-
|
|
523
|
-
|
|
522
|
+
.select:not(select) [role='option'].active,
|
|
523
|
+
.select:not(select) [role='option']:focus-visible {
|
|
524
524
|
@apply bg-muted text-foreground [&_svg]:text-foreground;
|
|
525
525
|
}
|
|
526
526
|
|
|
527
|
-
|
|
527
|
+
.select:not(select) [role='group'] {
|
|
528
528
|
@apply scroll-my-1.5 p-1.5;
|
|
529
529
|
}
|
|
530
530
|
|
|
531
|
-
|
|
531
|
+
.select:not(select) [role='separator'] {
|
|
532
532
|
@apply bg-border/50 -mx-1.5 my-1.5 h-px;
|
|
533
533
|
}
|
|
534
534
|
|
|
@@ -824,11 +824,11 @@
|
|
|
824
824
|
@apply bg-background;
|
|
825
825
|
}
|
|
826
826
|
|
|
827
|
-
.dark :is(.field > input[type='checkbox'][role='switch'], .input[type='checkbox'][role='switch']):not(:checked):before {
|
|
827
|
+
html.dark :is(.field > input[type='checkbox'][role='switch'], .input[type='checkbox'][role='switch']):not(:checked):before {
|
|
828
828
|
@apply bg-foreground;
|
|
829
829
|
}
|
|
830
830
|
|
|
831
|
-
.dark :is(.field > input[type='checkbox'][role='switch'], .input[type='checkbox'][role='switch']):checked:before {
|
|
831
|
+
html.dark :is(.field > input[type='checkbox'][role='switch'], .input[type='checkbox'][role='switch']):checked:before {
|
|
832
832
|
@apply bg-primary-foreground;
|
|
833
833
|
}
|
|
834
834
|
|
package/dist/styles/vega.css
CHANGED
|
@@ -468,51 +468,51 @@
|
|
|
468
468
|
@apply mb-1 w-full;
|
|
469
469
|
}
|
|
470
470
|
/* Select */
|
|
471
|
-
|
|
471
|
+
.select:not(select) > button {
|
|
472
472
|
@apply border-input dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 h-9 data-[size=sm]:h-8 gap-1.5 rounded-md border bg-transparent py-2 ps-2.5 pe-2 text-sm shadow-xs transition-[color,box-shadow] focus-visible:ring-3 aria-invalid:ring-3 [&_svg:not([class*='size-'])]:size-4;
|
|
473
473
|
}
|
|
474
474
|
|
|
475
|
-
|
|
475
|
+
.select:not(select) > button > span {
|
|
476
476
|
@apply gap-1.5;
|
|
477
477
|
}
|
|
478
478
|
|
|
479
|
-
|
|
479
|
+
.select:not(select) > button > svg {
|
|
480
480
|
@apply text-muted-foreground size-4;
|
|
481
481
|
}
|
|
482
482
|
|
|
483
|
-
|
|
483
|
+
.select:not(select) [data-popover] {
|
|
484
484
|
@apply bg-popover text-popover-foreground ring-foreground/10 rounded-md p-1 shadow-md ring-1 duration-100;
|
|
485
485
|
}
|
|
486
486
|
|
|
487
487
|
|
|
488
488
|
|
|
489
489
|
|
|
490
|
-
|
|
490
|
+
.select:not(select) [role='listbox'] {
|
|
491
491
|
@apply scroll-py-1;
|
|
492
492
|
}
|
|
493
493
|
|
|
494
|
-
|
|
494
|
+
.select:not(select) [role='listbox']:not(:has([data-value]:not([aria-hidden='true'])))::before {
|
|
495
495
|
@apply py-6 text-center text-sm;
|
|
496
496
|
}
|
|
497
497
|
|
|
498
|
-
|
|
498
|
+
.select:not(select) [role='heading'] {
|
|
499
499
|
@apply text-muted-foreground px-2 py-1.5 text-xs;
|
|
500
500
|
}
|
|
501
501
|
|
|
502
|
-
|
|
502
|
+
.select:not(select) [role='option'] {
|
|
503
503
|
@apply gap-2 rounded-sm py-1.5 ps-2 pe-8 text-sm [&_svg:not([class*='size-'])]:size-4;
|
|
504
504
|
}
|
|
505
505
|
|
|
506
|
-
|
|
507
|
-
|
|
506
|
+
.select:not(select) [role='option'].active,
|
|
507
|
+
.select:not(select) [role='option']:focus-visible {
|
|
508
508
|
@apply bg-muted text-foreground [&_svg]:text-foreground;
|
|
509
509
|
}
|
|
510
510
|
|
|
511
|
-
|
|
511
|
+
.select:not(select) [role='group'] {
|
|
512
512
|
@apply scroll-my-1 p-1;
|
|
513
513
|
}
|
|
514
514
|
|
|
515
|
-
|
|
515
|
+
.select:not(select) [role='separator'] {
|
|
516
516
|
@apply bg-border -mx-1 my-1 h-px;
|
|
517
517
|
}
|
|
518
518
|
|
|
@@ -808,11 +808,11 @@
|
|
|
808
808
|
@apply bg-background rounded-full;
|
|
809
809
|
}
|
|
810
810
|
|
|
811
|
-
.dark :is(.field > input[type='checkbox'][role='switch'], .input[type='checkbox'][role='switch']):not(:checked):before {
|
|
811
|
+
html.dark :is(.field > input[type='checkbox'][role='switch'], .input[type='checkbox'][role='switch']):not(:checked):before {
|
|
812
812
|
@apply bg-foreground;
|
|
813
813
|
}
|
|
814
814
|
|
|
815
|
-
.dark :is(.field > input[type='checkbox'][role='switch'], .input[type='checkbox'][role='switch']):checked:before {
|
|
815
|
+
html.dark :is(.field > input[type='checkbox'][role='switch'], .input[type='checkbox'][role='switch']):checked:before {
|
|
816
816
|
@apply bg-primary-foreground;
|
|
817
817
|
}
|
|
818
818
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "basecoat-css",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Tailwind CSS for Basecoat components",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "hunvreus",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"main": "dist/basecoat.css",
|
|
12
12
|
"style": "dist/basecoat.css",
|
|
13
13
|
"files": [
|
|
14
|
-
"dist/"
|
|
14
|
+
"dist/",
|
|
15
|
+
"templates/"
|
|
15
16
|
],
|
|
16
17
|
"keywords": [
|
|
17
18
|
"components",
|
|
@@ -30,13 +31,12 @@
|
|
|
30
31
|
],
|
|
31
32
|
"repository": {
|
|
32
33
|
"type": "git",
|
|
33
|
-
"url": "git+https://github.com/hunvreus/basecoat.git"
|
|
34
|
-
"directory": "packages/css"
|
|
34
|
+
"url": "git+https://github.com/hunvreus/basecoat.git"
|
|
35
35
|
},
|
|
36
36
|
"bugs": {
|
|
37
37
|
"url": "https://github.com/hunvreus/basecoat/issues"
|
|
38
38
|
},
|
|
39
|
-
"homepage": "https://basecoatui.com/installation#
|
|
39
|
+
"homepage": "https://basecoatui.com/installation#npm",
|
|
40
40
|
"exports": {
|
|
41
41
|
".": "./dist/basecoat.css",
|
|
42
42
|
"./css": "./dist/basecoat.css",
|
|
@@ -44,6 +44,8 @@
|
|
|
44
44
|
"./basecoat.min": "./dist/js/basecoat.min.js",
|
|
45
45
|
"./all": "./dist/js/all.js",
|
|
46
46
|
"./all.min": "./dist/js/all.min.js",
|
|
47
|
+
"./accordion": "./dist/js/accordion.js",
|
|
48
|
+
"./accordion.min": "./dist/js/accordion.min.js",
|
|
47
49
|
"./chart": "./dist/js/chart.js",
|
|
48
50
|
"./chart.min": "./dist/js/chart.min.js",
|
|
49
51
|
"./combobox": "./dist/js/combobox.js",
|
|
@@ -114,6 +116,24 @@
|
|
|
114
116
|
"./styles/style-luma.css": "./dist/styles/luma.css",
|
|
115
117
|
"./styles/style-sera.css": "./dist/styles/sera.css",
|
|
116
118
|
"./styles/style-rhea.css": "./dist/styles/rhea.css",
|
|
117
|
-
"./styles/style-*.css": "./dist/styles/*.css"
|
|
119
|
+
"./styles/style-*.css": "./dist/styles/*.css",
|
|
120
|
+
"./templates/nunjucks/*": "./templates/nunjucks/*",
|
|
121
|
+
"./templates/jinja/*": "./templates/jinja/*"
|
|
122
|
+
},
|
|
123
|
+
"scripts": {
|
|
124
|
+
"build": "node ./scripts/build.js",
|
|
125
|
+
"prepack": "node ./scripts/build.js",
|
|
126
|
+
"docs:build": "npm run build && npm --prefix site run build",
|
|
127
|
+
"docs:dev": "npm --prefix site run dev",
|
|
128
|
+
"docs:preview": "npm run docs:build && npm --prefix site run preview",
|
|
129
|
+
"workers:dev": "npm run build && npm --prefix site run workers:dev",
|
|
130
|
+
"workers:deploy": "npm run build && npm --prefix site run workers:deploy",
|
|
131
|
+
"workers:preview": "npm run build && npm --prefix site run workers:preview"
|
|
132
|
+
},
|
|
133
|
+
"devDependencies": {
|
|
134
|
+
"@tailwindcss/cli": "^4.1.17",
|
|
135
|
+
"prettier": "^3.5.3",
|
|
136
|
+
"tailwindcss": "^4.1.17",
|
|
137
|
+
"terser": "^5.42.0"
|
|
118
138
|
}
|
|
119
139
|
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
{#
|
|
2
|
+
Renders an input-first combobox component.
|
|
3
|
+
#}
|
|
4
|
+
{% macro combobox(
|
|
5
|
+
id=None,
|
|
6
|
+
selected=None,
|
|
7
|
+
name=None,
|
|
8
|
+
multiple=false,
|
|
9
|
+
placeholder=None,
|
|
10
|
+
close_on_select=false,
|
|
11
|
+
clear=false,
|
|
12
|
+
auto_highlight=false,
|
|
13
|
+
format="value",
|
|
14
|
+
main_attrs={},
|
|
15
|
+
input_attrs={},
|
|
16
|
+
popover_attrs={},
|
|
17
|
+
listbox_attrs={},
|
|
18
|
+
hidden_input_attrs={}
|
|
19
|
+
) %}
|
|
20
|
+
{% set id = id or ("combobox-" + (range(100000, 999999) | random | string)) %}
|
|
21
|
+
{% set main_attrs = main_attrs or {} %}
|
|
22
|
+
{% set input_attrs = input_attrs or {} %}
|
|
23
|
+
{% set popover_attrs = popover_attrs or {} %}
|
|
24
|
+
{% set listbox_attrs = listbox_attrs or {} %}
|
|
25
|
+
{% set hidden_input_attrs = hidden_input_attrs or {} %}
|
|
26
|
+
{% set selected_entries = namespace(items=[]) %}
|
|
27
|
+
{% if selected is defined and selected is iterable and selected is not string %}
|
|
28
|
+
{% set selected_values = selected %}
|
|
29
|
+
{% for item in selected %}
|
|
30
|
+
{% if item.value is defined %}
|
|
31
|
+
{% set selected_entries.items = selected_entries.items + [{'value': item.value, 'label': item.label if item.label is defined else item.value}] %}
|
|
32
|
+
{% else %}
|
|
33
|
+
{% set selected_entries.items = selected_entries.items + [{'value': item, 'label': item}] %}
|
|
34
|
+
{% endif %}
|
|
35
|
+
{% endfor %}
|
|
36
|
+
{% elif selected is defined and selected %}
|
|
37
|
+
{% if selected.value is defined %}
|
|
38
|
+
{% set selected_values = [selected.value] %}
|
|
39
|
+
{% set selected_entries.items = [{'value': selected.value, 'label': selected.label if selected.label is defined else selected.value}] %}
|
|
40
|
+
{% else %}
|
|
41
|
+
{% set selected_values = [selected] %}
|
|
42
|
+
{% set selected_entries.items = [{'value': selected, 'label': selected}] %}
|
|
43
|
+
{% endif %}
|
|
44
|
+
{% else %}
|
|
45
|
+
{% set selected_values = [] %}
|
|
46
|
+
{% endif %}
|
|
47
|
+
{% set hidden_value = ((selected_entries.items | tojson if multiple else ((selected_entries.items[0] if selected_entries.items else none) | tojson)) if format == "object" else (selected_values | tojson if multiple else (selected_values[0] if selected_values else ''))) %}
|
|
48
|
+
|
|
49
|
+
<div
|
|
50
|
+
id="{{ id }}"
|
|
51
|
+
class="combobox {{ main_attrs.class | default('') }}"
|
|
52
|
+
{% if format == "object" %}data-format="object"{% endif %}
|
|
53
|
+
{% if multiple and close_on_select %}data-close-on-select="true"{% endif %}
|
|
54
|
+
{% if auto_highlight %}data-auto-highlight="true"{% endif %}
|
|
55
|
+
{% for key, value in main_attrs.items() %}
|
|
56
|
+
{% if key != 'class' %}{{ key }}="{{ value }}"{% endif %}
|
|
57
|
+
{% endfor %}
|
|
58
|
+
>
|
|
59
|
+
{% if multiple %}
|
|
60
|
+
<input
|
|
61
|
+
type="text"
|
|
62
|
+
role="combobox"
|
|
63
|
+
class="{{ input_attrs.class | default('') }}"
|
|
64
|
+
placeholder="{{ placeholder or '' }}"
|
|
65
|
+
autocomplete="off"
|
|
66
|
+
autocorrect="off"
|
|
67
|
+
spellcheck="false"
|
|
68
|
+
aria-autocomplete="list"
|
|
69
|
+
aria-expanded="false"
|
|
70
|
+
aria-controls="{{ id }}-listbox"
|
|
71
|
+
{% for key, value in input_attrs.items() %}
|
|
72
|
+
{% if key != 'class' %}{{ key }}="{{ value }}"{% endif %}
|
|
73
|
+
{% endfor %}
|
|
74
|
+
>
|
|
75
|
+
{% elif clear %}
|
|
76
|
+
<div class="input-group {{ input_attrs.class | default('') }}">
|
|
77
|
+
<input
|
|
78
|
+
type="text"
|
|
79
|
+
role="combobox"
|
|
80
|
+
placeholder="{{ placeholder or '' }}"
|
|
81
|
+
autocomplete="off"
|
|
82
|
+
autocorrect="off"
|
|
83
|
+
spellcheck="false"
|
|
84
|
+
aria-autocomplete="list"
|
|
85
|
+
aria-expanded="false"
|
|
86
|
+
aria-controls="{{ id }}-listbox"
|
|
87
|
+
{% for key, value in input_attrs.items() %}
|
|
88
|
+
{% if key != 'class' %}{{ key }}="{{ value }}"{% endif %}
|
|
89
|
+
{% endfor %}
|
|
90
|
+
>
|
|
91
|
+
<span role="group" data-align="inline-end">
|
|
92
|
+
<button type="button" data-clear aria-label="Clear selection">
|
|
93
|
+
<svg class="size-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>
|
|
94
|
+
</button>
|
|
95
|
+
<button type="button" class="btn" data-variant="ghost" data-size="icon-xs" aria-label="Open suggestions" aria-haspopup="listbox" aria-expanded="false" aria-controls="{{ id }}-listbox">
|
|
96
|
+
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>
|
|
97
|
+
</button>
|
|
98
|
+
</span>
|
|
99
|
+
</div>
|
|
100
|
+
{% else %}
|
|
101
|
+
<input
|
|
102
|
+
type="text"
|
|
103
|
+
role="combobox"
|
|
104
|
+
placeholder="{{ placeholder or '' }}"
|
|
105
|
+
autocomplete="off"
|
|
106
|
+
autocorrect="off"
|
|
107
|
+
spellcheck="false"
|
|
108
|
+
aria-autocomplete="list"
|
|
109
|
+
aria-expanded="false"
|
|
110
|
+
aria-controls="{{ id }}-listbox"
|
|
111
|
+
class="{{ input_attrs.class | default('') }}"
|
|
112
|
+
{% for key, value in input_attrs.items() %}
|
|
113
|
+
{% if key != 'class' %}{{ key }}="{{ value }}"{% endif %}
|
|
114
|
+
{% endfor %}
|
|
115
|
+
>
|
|
116
|
+
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="combobox-trigger-icon"><path d="m6 9 6 6 6-6"/></svg>
|
|
117
|
+
{% endif %}
|
|
118
|
+
<div
|
|
119
|
+
id="{{ id }}-popover"
|
|
120
|
+
data-popover
|
|
121
|
+
aria-hidden="true"
|
|
122
|
+
{% for key, value in popover_attrs.items() %}
|
|
123
|
+
{{ key }}="{{ value }}"
|
|
124
|
+
{% endfor %}
|
|
125
|
+
>
|
|
126
|
+
<div
|
|
127
|
+
role="listbox"
|
|
128
|
+
id="{{ id }}-listbox"
|
|
129
|
+
aria-orientation="vertical"
|
|
130
|
+
{% if multiple %}aria-multiselectable="true"{% endif %}
|
|
131
|
+
{% for key, value in listbox_attrs.items() %}
|
|
132
|
+
{{ key }}="{{ value }}"
|
|
133
|
+
{% endfor %}
|
|
134
|
+
>
|
|
135
|
+
{{ caller() if caller is defined else '' }}
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
<input
|
|
139
|
+
type="hidden"
|
|
140
|
+
{% if name %}name="{{ name }}"{% endif %}
|
|
141
|
+
value='{{ hidden_value }}'
|
|
142
|
+
{% for key, value in hidden_input_attrs.items() %}
|
|
143
|
+
{{ key }}="{{ value }}"
|
|
144
|
+
{% endfor %}
|
|
145
|
+
>
|
|
146
|
+
</div>
|
|
147
|
+
{% endmacro %}
|