@noctuatech/uswds 1.2.1 → 1.3.1
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/package.json +55 -20
- package/src/lib/accordion/accordion.element.ts +19 -19
- package/src/lib/breadcrumbs/breadcrumb/breadcrumb.element.ts +8 -10
- package/src/lib/breadcrumbs/breadcrumbs.stories.ts +3 -3
- package/src/lib/button/button.element.ts +2 -2
- package/src/lib/checkbox/checkbox.element.ts +23 -32
- package/src/lib/combo-box/combo-box.element.ts +14 -24
- package/src/lib/file-input/file-input-preview/file-input-preview.element.ts +26 -25
- package/src/lib/file-input/file-input.element.ts +28 -43
- package/src/lib/input/input.element.ts +9 -18
- package/src/lib/modal/modal-heading/modal-heading.element.ts +1 -1
- package/src/lib/modal/modal.element.ts +1 -1
- package/src/lib/radio/radio.element.ts +5 -3
- package/src/lib/range-slider/range-slider.element.ts +2 -2
- package/src/lib/search/search.element.ts +2 -2
- package/src/lib/select/select.element.ts +10 -19
- package/src/lib/textarea/textarea.element.ts +10 -19
- package/target/lib/accordion/accordion.element.d.ts +1 -2
- package/target/lib/accordion/accordion.element.js +9 -7
- package/target/lib/accordion/accordion.element.js.map +1 -1
- package/target/lib/breadcrumbs/breadcrumb/breadcrumb.element.d.ts +0 -2
- package/target/lib/breadcrumbs/breadcrumb/breadcrumb.element.js +7 -6
- package/target/lib/breadcrumbs/breadcrumb/breadcrumb.element.js.map +1 -1
- package/target/lib/breadcrumbs/breadcrumbs.stories.js +1 -1
- package/target/lib/button/button.element.js +1 -1
- package/target/lib/checkbox/checkbox.element.js +2 -2
- package/target/lib/checkbox/checkbox.element.js.map +1 -1
- package/target/lib/combo-box/combo-box.element.js +2 -2
- package/target/lib/combo-box/combo-box.element.js.map +1 -1
- package/target/lib/file-input/file-input-preview/file-input-preview.element.d.ts +3 -5
- package/target/lib/file-input/file-input-preview/file-input-preview.element.js +29 -19
- package/target/lib/file-input/file-input-preview/file-input-preview.element.js.map +1 -1
- package/target/lib/file-input/file-input.element.d.ts +2 -2
- package/target/lib/file-input/file-input.element.js +20 -22
- package/target/lib/file-input/file-input.element.js.map +1 -1
- package/target/lib/input/input.element.js +2 -2
- package/target/lib/input/input.element.js.map +1 -1
- package/target/lib/modal/modal-heading/modal-heading.element.js +1 -1
- package/target/lib/modal/modal.element.js +1 -1
- package/target/lib/radio/radio.element.js +1 -1
- package/target/lib/radio/radio.element.js.map +1 -1
- package/target/lib/range-slider/range-slider.element.js +1 -1
- package/target/lib/search/search.element.js +1 -1
- package/target/lib/select/select.element.js +2 -2
- package/target/lib/select/select.element.js.map +1 -1
- package/target/lib/textarea/textarea.element.js +2 -2
- package/target/lib/textarea/textarea.element.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noctuatech/uswds",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"workspaces": [
|
|
5
|
+
"workspaces": [
|
|
6
|
+
"packages/**"
|
|
7
|
+
],
|
|
6
8
|
"main": "./target/lib.js",
|
|
7
9
|
"module": "./target/lib.js",
|
|
8
10
|
"exports": {
|
|
9
11
|
".": "./target/lib.js",
|
|
10
12
|
"./*": "./target/lib/*"
|
|
11
13
|
},
|
|
12
|
-
"files": [
|
|
14
|
+
"files": [
|
|
15
|
+
"src",
|
|
16
|
+
"target",
|
|
17
|
+
"assets"
|
|
18
|
+
],
|
|
13
19
|
"scripts": {
|
|
14
20
|
"test": "wireit",
|
|
15
21
|
"build": "wireit",
|
|
@@ -22,14 +28,23 @@
|
|
|
22
28
|
"wireit": {
|
|
23
29
|
"prepare": {
|
|
24
30
|
"command": "husky",
|
|
25
|
-
"dependencies": [
|
|
31
|
+
"dependencies": [
|
|
32
|
+
"copy_icons"
|
|
33
|
+
]
|
|
26
34
|
},
|
|
27
35
|
"test": {
|
|
28
36
|
"command": "wtr",
|
|
29
|
-
"dependencies": [
|
|
37
|
+
"dependencies": [
|
|
38
|
+
"tsc",
|
|
39
|
+
"build_testing_library"
|
|
40
|
+
]
|
|
30
41
|
},
|
|
31
42
|
"build": {
|
|
32
|
-
"dependencies": [
|
|
43
|
+
"dependencies": [
|
|
44
|
+
"tsc",
|
|
45
|
+
"build_storybook",
|
|
46
|
+
"minify_html_literals"
|
|
47
|
+
]
|
|
33
48
|
},
|
|
34
49
|
"preview": {
|
|
35
50
|
"command": "eleventy --serve --incremental",
|
|
@@ -46,39 +61,56 @@
|
|
|
46
61
|
},
|
|
47
62
|
"build_testing_library": {
|
|
48
63
|
"command": "./scripts/build_testing_library.sh",
|
|
49
|
-
"files": [
|
|
50
|
-
|
|
64
|
+
"files": [
|
|
65
|
+
"node_modules/@testing-library/**"
|
|
66
|
+
],
|
|
67
|
+
"output": [
|
|
68
|
+
"testing-library/**"
|
|
69
|
+
]
|
|
51
70
|
},
|
|
52
71
|
"tsc": {
|
|
53
72
|
"command": "tsc --build --pretty",
|
|
54
73
|
"clean": "if-file-deleted",
|
|
55
|
-
"files": [
|
|
56
|
-
|
|
74
|
+
"files": [
|
|
75
|
+
"src/**",
|
|
76
|
+
"tsconfig.json"
|
|
77
|
+
],
|
|
78
|
+
"output": [
|
|
79
|
+
"target/**",
|
|
80
|
+
"tsconfig.tsbuildinfo"
|
|
81
|
+
]
|
|
57
82
|
},
|
|
58
83
|
"copy_icons": {
|
|
59
84
|
"command": "./scripts/copy_usa_icons.sh",
|
|
60
|
-
"files": [
|
|
61
|
-
|
|
85
|
+
"files": [
|
|
86
|
+
"node_modules/@uswds/uswds/dist/img/usa-icons/**"
|
|
87
|
+
],
|
|
88
|
+
"output": [
|
|
89
|
+
"assets/usa-icon/**"
|
|
90
|
+
]
|
|
62
91
|
},
|
|
63
92
|
"minify_html_literals": {
|
|
64
93
|
"command": "./scripts/minify_html_literals.js",
|
|
65
|
-
"files": [
|
|
66
|
-
|
|
94
|
+
"files": [
|
|
95
|
+
"target/**/*.js"
|
|
96
|
+
],
|
|
97
|
+
"dependencies": [
|
|
98
|
+
"tsc"
|
|
99
|
+
]
|
|
67
100
|
}
|
|
68
101
|
},
|
|
69
102
|
"author": "",
|
|
70
103
|
"license": "ISC",
|
|
71
104
|
"description": "",
|
|
72
105
|
"dependencies": {
|
|
73
|
-
"@joist/di": "^4.2.3-next.
|
|
74
|
-
"@joist/element": "^4.2.3-next.
|
|
75
|
-
"@joist/observable": "^4.2.3-next.
|
|
76
|
-
"@joist/templating": "^4.2.3-next.
|
|
106
|
+
"@joist/di": "^4.2.3-next.14",
|
|
107
|
+
"@joist/element": "^4.2.3-next.14",
|
|
108
|
+
"@joist/observable": "^4.2.3-next.14",
|
|
109
|
+
"@joist/templating": "^4.2.3-next.14",
|
|
77
110
|
"tslib": "2.8.1"
|
|
78
111
|
},
|
|
79
112
|
"devDependencies": {
|
|
80
113
|
"@11ty/eleventy": "^3.0.0",
|
|
81
|
-
"@biomejs/biome": "1.9.4",
|
|
82
114
|
"@open-wc/testing": "^4.0.0",
|
|
83
115
|
"@storybook/addon-essentials": "^8.6.0",
|
|
84
116
|
"@storybook/web-components": "^8.6.0",
|
|
@@ -97,11 +129,14 @@
|
|
|
97
129
|
"minify-literals": "^1.0.10",
|
|
98
130
|
"mocha": "^11.0.0",
|
|
99
131
|
"plop": "^4.0.1",
|
|
132
|
+
"prettier": "^3.5.3",
|
|
100
133
|
"storybook": "^8.6.0",
|
|
101
134
|
"typescript": "^5.8.0",
|
|
102
135
|
"wireit": "^0.14.9"
|
|
103
136
|
},
|
|
104
137
|
"lint-staged": {
|
|
105
|
-
"*": [
|
|
138
|
+
"*": [
|
|
139
|
+
"prettier --write --ignore-unknown"
|
|
140
|
+
]
|
|
106
141
|
}
|
|
107
142
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "@joist/templating/define.js";
|
|
2
|
+
|
|
3
|
+
import { attr, css, element, html, listen } from "@joist/element";
|
|
4
|
+
import { bind } from "@joist/templating";
|
|
2
5
|
|
|
3
6
|
import { USAAccordionToggleEvent } from "./events.js";
|
|
4
7
|
|
|
@@ -88,18 +91,20 @@ declare global {
|
|
|
88
91
|
}
|
|
89
92
|
`,
|
|
90
93
|
html`
|
|
91
|
-
<
|
|
92
|
-
<
|
|
93
|
-
<
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
94
|
+
<j-props>
|
|
95
|
+
<details $.open="open">
|
|
96
|
+
<summary>
|
|
97
|
+
<slot name="heading"></slot>
|
|
98
|
+
|
|
99
|
+
<usa-icon icon="add"></usa-icon>
|
|
100
|
+
<usa-icon icon="remove"></usa-icon>
|
|
101
|
+
</summary>
|
|
102
|
+
|
|
103
|
+
<div class="content">
|
|
104
|
+
<slot></slot>
|
|
105
|
+
</div>
|
|
106
|
+
</details>
|
|
107
|
+
</j-props>
|
|
103
108
|
`,
|
|
104
109
|
],
|
|
105
110
|
})
|
|
@@ -108,14 +113,9 @@ export class USAAccordionElement extends HTMLElement {
|
|
|
108
113
|
accessor name = "";
|
|
109
114
|
|
|
110
115
|
@attr()
|
|
116
|
+
@bind()
|
|
111
117
|
accessor open = false;
|
|
112
118
|
|
|
113
|
-
#details = query("details");
|
|
114
|
-
|
|
115
|
-
attributeChangedCallback() {
|
|
116
|
-
this.#details({ open: this.open });
|
|
117
|
-
}
|
|
118
|
-
|
|
119
119
|
@listen("click", "summary")
|
|
120
120
|
onClick(e: Event) {
|
|
121
121
|
e.preventDefault();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { attr, css, element, html
|
|
1
|
+
import { attr, css, element, html } from "@joist/element";
|
|
2
|
+
import { bind } from "@joist/templating";
|
|
2
3
|
|
|
3
4
|
declare global {
|
|
4
5
|
interface HTMLElementTagNameMap {
|
|
@@ -36,9 +37,11 @@ declare global {
|
|
|
36
37
|
}
|
|
37
38
|
`,
|
|
38
39
|
html`
|
|
39
|
-
<
|
|
40
|
-
<
|
|
41
|
-
|
|
40
|
+
<j-props>
|
|
41
|
+
<a $.href="href">
|
|
42
|
+
<slot></slot>
|
|
43
|
+
</a>
|
|
44
|
+
</j-props>
|
|
42
45
|
|
|
43
46
|
<usa-icon icon="navigate_next"></usa-icon>
|
|
44
47
|
`,
|
|
@@ -46,14 +49,9 @@ declare global {
|
|
|
46
49
|
})
|
|
47
50
|
export class USABreadcrumbElement extends HTMLElement {
|
|
48
51
|
@attr()
|
|
52
|
+
@bind()
|
|
49
53
|
accessor href = "";
|
|
50
54
|
|
|
51
55
|
@attr()
|
|
52
56
|
accessor role = "listitem";
|
|
53
|
-
|
|
54
|
-
#a = query("a");
|
|
55
|
-
|
|
56
|
-
attributeChangedCallback() {
|
|
57
|
-
this.#a({ href: this.href });
|
|
58
|
-
}
|
|
59
57
|
}
|
|
@@ -10,9 +10,9 @@ const meta = {
|
|
|
10
10
|
render(args) {
|
|
11
11
|
return html`
|
|
12
12
|
<usa-breadcrumbs ?wrap=${args.wrap}>
|
|
13
|
-
<usa-breadcrumb href="/">Home</usa-breadcrumb>
|
|
14
|
-
<usa-breadcrumb href="/">Federal Contracting</usa-breadcrumb>
|
|
15
|
-
<usa-breadcrumb href="/">Contracting assistance programs</usa-breadcrumb>
|
|
13
|
+
<usa-breadcrumb href="/home">Home</usa-breadcrumb>
|
|
14
|
+
<usa-breadcrumb href="/federal-contracting">Federal Contracting</usa-breadcrumb>
|
|
15
|
+
<usa-breadcrumb href="/contracting-assistance-programs">Contracting assistance programs</usa-breadcrumb>
|
|
16
16
|
<usa-breadcrumb>Economically disadvantaged women-owned small business federal contracting program</usa-breadcrumb>
|
|
17
17
|
</usa-breadcrumbs>
|
|
18
18
|
`;
|
|
@@ -172,7 +172,7 @@ export type ButtonVariant = (typeof BUTTON_VARIANTS)[number];
|
|
|
172
172
|
<j-if bind="href">
|
|
173
173
|
<template>
|
|
174
174
|
<j-props>
|
|
175
|
-
<a $href="href" $disabled="disabled" $target="target">
|
|
175
|
+
<a part="link" $href="href" $disabled="disabled" $target="target">
|
|
176
176
|
<slot></slot>
|
|
177
177
|
</a>
|
|
178
178
|
</j-props>
|
|
@@ -180,7 +180,7 @@ export type ButtonVariant = (typeof BUTTON_VARIANTS)[number];
|
|
|
180
180
|
|
|
181
181
|
<template else>
|
|
182
182
|
<j-props>
|
|
183
|
-
<button tabindex="0" $type="type" $disabled="disabled" $value="value">
|
|
183
|
+
<button tabindex="0" part="button" $type="type" $disabled="disabled" $value="value">
|
|
184
184
|
<slot></slot>
|
|
185
185
|
</button>
|
|
186
186
|
</j-props>
|
|
@@ -15,26 +15,16 @@ declare global {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
:host {
|
|
18
|
-
--usa-input-bg-color: #fff;
|
|
19
|
-
--usa-input-border-color: #5c5c5c;
|
|
20
|
-
--usa-input-text-color: #1b1b1b;
|
|
21
|
-
--usa-input-focus-color: #2491ff;
|
|
22
|
-
--usa-input-disabled-bg-color: #fff;
|
|
23
|
-
--usa-input-disabled-border-color: #757575;
|
|
24
|
-
--usa-input-disabled-text-color: #757575;
|
|
25
|
-
--usa-input-active-color: #005ea2;
|
|
26
|
-
--usa-input-radius: 0;
|
|
27
|
-
|
|
28
18
|
display: inline-block;
|
|
29
19
|
max-width: 30rem;
|
|
30
20
|
position: relative;
|
|
31
21
|
}
|
|
32
22
|
|
|
33
23
|
:host([tiled]) label {
|
|
34
|
-
background-color:
|
|
35
|
-
border: 2px solid
|
|
36
|
-
border-radius:
|
|
37
|
-
color:
|
|
24
|
+
background-color: #fff;
|
|
25
|
+
border: 2px solid #5c5c5c;
|
|
26
|
+
border-radius: 0.25rem;
|
|
27
|
+
color: #1b1b1b;
|
|
38
28
|
padding: 0.75rem 1rem 0.75rem 0.75rem;
|
|
39
29
|
}
|
|
40
30
|
|
|
@@ -47,37 +37,37 @@ declare global {
|
|
|
47
37
|
}
|
|
48
38
|
|
|
49
39
|
.checkbox {
|
|
50
|
-
background:
|
|
51
|
-
box-shadow: 0 0 0 2px
|
|
40
|
+
background: #fff;
|
|
41
|
+
box-shadow: 0 0 0 2px #1b1b1b;
|
|
52
42
|
display: flex;
|
|
53
43
|
align-items: center;
|
|
54
44
|
justify-content: center;
|
|
55
45
|
height: 1.25rem;
|
|
56
46
|
min-width: 1.25rem;
|
|
57
47
|
max-width: 1.25rem;
|
|
58
|
-
border-radius:
|
|
48
|
+
border-radius: 2px;
|
|
59
49
|
position: relative;
|
|
60
50
|
margin-right: 0.75rem;
|
|
61
51
|
}
|
|
62
52
|
|
|
63
53
|
input:disabled + .checkbox {
|
|
64
|
-
background-color:
|
|
65
|
-
box-shadow: 0 0 0 2px
|
|
54
|
+
background-color: #fff;
|
|
55
|
+
box-shadow: 0 0 0 2px #757575;
|
|
66
56
|
}
|
|
67
57
|
|
|
68
58
|
input:disabled:is(:checked) + .checkbox {
|
|
69
|
-
background-color:
|
|
70
|
-
box-shadow: 0 0 0 2px
|
|
59
|
+
background-color: #757575;
|
|
60
|
+
box-shadow: 0 0 0 2px #757575;
|
|
71
61
|
}
|
|
72
62
|
|
|
73
63
|
:host([disabled]) label {
|
|
74
|
-
color:
|
|
64
|
+
color: #757575;
|
|
75
65
|
cursor: not-allowed;
|
|
76
66
|
}
|
|
77
67
|
|
|
78
68
|
input:checked + .checkbox {
|
|
79
|
-
background-color:
|
|
80
|
-
box-shadow: 0 0 0 2px
|
|
69
|
+
background-color: #005ea2;
|
|
70
|
+
box-shadow: 0 0 0 2px #005ea2;
|
|
81
71
|
}
|
|
82
72
|
|
|
83
73
|
input:checked + .checkbox::after {
|
|
@@ -95,7 +85,7 @@ declare global {
|
|
|
95
85
|
}
|
|
96
86
|
|
|
97
87
|
input:focus + .checkbox {
|
|
98
|
-
outline: 0.25rem solid
|
|
88
|
+
outline: 0.25rem solid #2491ff;
|
|
99
89
|
outline-offset: 0.25rem;
|
|
100
90
|
}
|
|
101
91
|
|
|
@@ -112,23 +102,24 @@ declare global {
|
|
|
112
102
|
|
|
113
103
|
:host([tiled]) label:has(input:checked) {
|
|
114
104
|
background-color: rgba(0, 94, 162, 0.1);
|
|
115
|
-
border-color:
|
|
105
|
+
border-color: #005ea2;
|
|
116
106
|
}
|
|
117
107
|
|
|
118
108
|
:host([tiled]) label:has(input:checked:is(:disabled)) {
|
|
119
|
-
background-color:
|
|
120
|
-
border-color:
|
|
109
|
+
background-color: #fff;
|
|
110
|
+
border-color: #757575;
|
|
121
111
|
}
|
|
122
112
|
`,
|
|
123
113
|
html`
|
|
124
114
|
<label>
|
|
125
115
|
<input type="checkbox" tabindex="0"/>
|
|
126
116
|
|
|
127
|
-
<div class="checkbox"></div>
|
|
117
|
+
<div class="checkbox" part="checkbox"></div>
|
|
128
118
|
|
|
129
|
-
<div class="title">
|
|
130
|
-
|
|
131
|
-
|
|
119
|
+
<div class="title" part="title">
|
|
120
|
+
<slot></slot>
|
|
121
|
+
</div>
|
|
122
|
+
</j-props>
|
|
132
123
|
</label>
|
|
133
124
|
`,
|
|
134
125
|
],
|
|
@@ -30,17 +30,6 @@ declare global {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
:host {
|
|
33
|
-
--usa-input-bg-color: #fff;
|
|
34
|
-
--usa-input-border-color: #5c5c5c;
|
|
35
|
-
--usa-input-text-color: #1b1b1b;
|
|
36
|
-
--usa-input-focus-color: #2491ff;
|
|
37
|
-
--usa-input-disabled-bg-color: #fff;
|
|
38
|
-
--usa-input-disabled-border-color: #757575;
|
|
39
|
-
--usa-input-disabled-text-color: #757575;
|
|
40
|
-
--usa-input-hover-bg-color: #f0f0f0;
|
|
41
|
-
--usa-combo-max-height: 12.5em;
|
|
42
|
-
--usa-input-radius: 0;
|
|
43
|
-
|
|
44
33
|
display: block;
|
|
45
34
|
max-width: 30rem;
|
|
46
35
|
position: relative;
|
|
@@ -49,11 +38,11 @@ declare global {
|
|
|
49
38
|
|
|
50
39
|
input {
|
|
51
40
|
border-width: 1px;
|
|
52
|
-
border-color:
|
|
41
|
+
border-color: #5c5c5c;
|
|
53
42
|
border-style: solid;
|
|
54
|
-
border-radius:
|
|
55
|
-
color:
|
|
56
|
-
background-color:
|
|
43
|
+
border-radius: 0;
|
|
44
|
+
color: #1b1b1b;
|
|
45
|
+
background-color: #fff;
|
|
57
46
|
display: block;
|
|
58
47
|
height: 2.5rem;
|
|
59
48
|
line-height: 1.3;
|
|
@@ -65,14 +54,14 @@ declare global {
|
|
|
65
54
|
}
|
|
66
55
|
|
|
67
56
|
input:not(:disabled):focus {
|
|
68
|
-
outline: 0.25rem solid
|
|
57
|
+
outline: 0.25rem solid #2491ff;
|
|
69
58
|
outline-offset: 0;
|
|
70
59
|
}
|
|
71
60
|
|
|
72
61
|
input:disabled {
|
|
73
|
-
background-color:
|
|
74
|
-
border-color:
|
|
75
|
-
color:
|
|
62
|
+
background-color: #fff;
|
|
63
|
+
border-color: #757575;
|
|
64
|
+
color: #757575;
|
|
76
65
|
}
|
|
77
66
|
|
|
78
67
|
ul {
|
|
@@ -82,8 +71,8 @@ declare global {
|
|
|
82
71
|
width: 100%;
|
|
83
72
|
transform: translateY(100%);
|
|
84
73
|
margin: 0;
|
|
85
|
-
border: 1px solid
|
|
86
|
-
max-height:
|
|
74
|
+
border: 1px solid #5c5c5c;
|
|
75
|
+
max-height: 12.5em;
|
|
87
76
|
overflow-y: scroll;
|
|
88
77
|
z-index: 1001;
|
|
89
78
|
}
|
|
@@ -93,7 +82,7 @@ declare global {
|
|
|
93
82
|
}
|
|
94
83
|
|
|
95
84
|
ul li {
|
|
96
|
-
background:
|
|
85
|
+
background: #fff;
|
|
97
86
|
list-style: none;
|
|
98
87
|
border-bottom: 1px solid #e6e6e6;
|
|
99
88
|
cursor: pointer;
|
|
@@ -101,11 +90,11 @@ declare global {
|
|
|
101
90
|
}
|
|
102
91
|
|
|
103
92
|
ul li:hover {
|
|
104
|
-
background-color:
|
|
93
|
+
background-color: #f0f0f0;
|
|
105
94
|
}
|
|
106
95
|
|
|
107
96
|
li:focus {
|
|
108
|
-
outline: 0.25rem solid
|
|
97
|
+
outline: 0.25rem solid #2491ff;
|
|
109
98
|
outline-offset: -0.25rem;
|
|
110
99
|
}
|
|
111
100
|
|
|
@@ -131,6 +120,7 @@ declare global {
|
|
|
131
120
|
<slot name="label"></slot>
|
|
132
121
|
|
|
133
122
|
<input
|
|
123
|
+
part="input"
|
|
134
124
|
tabindex="0"
|
|
135
125
|
role="combobox"
|
|
136
126
|
autocomplete="off"
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '@joist/templating/define.js';
|
|
2
2
|
|
|
3
|
-
import { css, element, html } from
|
|
4
|
-
import {
|
|
3
|
+
import { css, element, html } from '@joist/element';
|
|
4
|
+
import { observe } from '@joist/observable';
|
|
5
|
+
import { bind } from '@joist/templating';
|
|
5
6
|
|
|
6
7
|
declare global {
|
|
7
8
|
interface HTMLElementTagNameMap {
|
|
8
|
-
|
|
9
|
+
'usa-file-input-preview': USAFileInputPreviewElement;
|
|
9
10
|
}
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
@element({
|
|
13
|
-
tagName:
|
|
14
|
+
tagName: 'usa-file-input-preview',
|
|
14
15
|
shadowDom: [
|
|
15
16
|
css`
|
|
16
17
|
* {
|
|
@@ -25,7 +26,7 @@ declare global {
|
|
|
25
26
|
text-align: left;
|
|
26
27
|
word-wrap: anywhere;
|
|
27
28
|
z-index: 3;
|
|
28
|
-
border-radius:
|
|
29
|
+
border-radius: 0;
|
|
29
30
|
overflow: hidden;
|
|
30
31
|
}
|
|
31
32
|
|
|
@@ -44,8 +45,8 @@ declare global {
|
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
.preview-heading {
|
|
48
|
+
background: #d9e8f6;
|
|
47
49
|
align-items: center;
|
|
48
|
-
background: var(--usa-input-bg-color);
|
|
49
50
|
display: flex;
|
|
50
51
|
pointer-events: none;
|
|
51
52
|
position: relative;
|
|
@@ -54,23 +55,26 @@ declare global {
|
|
|
54
55
|
justify-content: space-between;
|
|
55
56
|
padding: 0.5rem;
|
|
56
57
|
text-align: left;
|
|
58
|
+
font-size: 0.93rem;
|
|
59
|
+
line-height: 1.6;
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
.preview-item {
|
|
63
|
+
background: #d9e8f6;
|
|
60
64
|
align-items: center;
|
|
61
|
-
background: var(--usa-input-bg-color);
|
|
62
65
|
display: flex;
|
|
63
66
|
padding: 0.5rem;
|
|
64
67
|
width: 100%;
|
|
65
68
|
margin-top: 1px;
|
|
69
|
+
margin-bottom: 1px;
|
|
66
70
|
}
|
|
67
71
|
`,
|
|
68
72
|
html`
|
|
69
|
-
<slot class="preview-heading"></slot>
|
|
70
|
-
|
|
73
|
+
<slot class="preview-heading" part="heading"></slot>
|
|
74
|
+
|
|
71
75
|
<j-for bind="fileEntries" key="src">
|
|
72
76
|
<template>
|
|
73
|
-
<div class="preview-item">
|
|
77
|
+
<div class="preview-item" part="item">
|
|
74
78
|
<j-if bind="each.value.isImage">
|
|
75
79
|
<template>
|
|
76
80
|
<j-props>
|
|
@@ -82,7 +86,7 @@ declare global {
|
|
|
82
86
|
<usa-icon icon="file_present"></usa-icon>
|
|
83
87
|
</template>
|
|
84
88
|
</j-if>
|
|
85
|
-
|
|
89
|
+
|
|
86
90
|
<j-value bind="each.value.file.name"></j-value>
|
|
87
91
|
</div>
|
|
88
92
|
</template>
|
|
@@ -91,24 +95,21 @@ declare global {
|
|
|
91
95
|
],
|
|
92
96
|
})
|
|
93
97
|
export class USAFileInputPreviewElement extends HTMLElement {
|
|
94
|
-
@
|
|
95
|
-
accessor
|
|
96
|
-
|
|
97
|
-
#files: FileList | null = null;
|
|
98
|
+
@observe()
|
|
99
|
+
accessor files: FileList | null = null;
|
|
98
100
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
set files(value: FileList | null) {
|
|
104
|
-
this.#files = value;
|
|
101
|
+
@bind((i) => {
|
|
102
|
+
if (!i.files || i.files.length === 0) {
|
|
103
|
+
return [];
|
|
104
|
+
}
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
return Array.from(i.files).map((file) => ({
|
|
107
107
|
file,
|
|
108
108
|
src: URL.createObjectURL(file),
|
|
109
|
-
isImage: file.type.startsWith(
|
|
109
|
+
isImage: file.type.startsWith('image'),
|
|
110
110
|
}));
|
|
111
|
-
}
|
|
111
|
+
})
|
|
112
|
+
accessor fileEntries: FileEntry[] = [];
|
|
112
113
|
}
|
|
113
114
|
|
|
114
115
|
interface FileEntry {
|