@noctuatech/uswds 1.3.2 → 1.3.4
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 +5 -5
- package/src/lib/accordion/{accordion.test.ts → accordion.element.test.ts} +28 -31
- package/src/lib/accordion/accordion.element.ts +9 -7
- package/src/lib/alert/{alert.test.ts → alert.element.test.ts} +5 -6
- package/src/lib/alert/alert.element.ts +6 -4
- package/src/lib/breadcrumbs/breadcrumb/breadcrumb.element.ts +10 -10
- package/src/lib/breadcrumbs/breadcrumbs.element.test.ts +23 -0
- package/src/lib/button/button.element.test.ts +15 -0
- package/src/lib/button/button.element.ts +37 -42
- package/src/lib/button-group/button-group.element.test.ts +13 -0
- package/src/lib/card/{card.test.ts → card.element.test.ts} +12 -12
- package/src/lib/checkbox/{checkbox.test.ts → checkbox.element.test.ts} +15 -17
- package/src/lib/checkbox/checkbox.element.ts +28 -32
- package/src/lib/checkbox/checkbox.stories.ts +17 -33
- package/src/lib/collection/collection-item/collection-item.element.test.ts +15 -0
- package/src/lib/collection/collection.element.test.ts +13 -0
- package/src/lib/combo-box/{combo-box.test.ts → combo-box.element.test.ts} +64 -93
- package/src/lib/config/config.element.test.ts +13 -0
- package/src/lib/description/description.element.test.ts +13 -0
- package/src/lib/file-input/file-input-preview/file-input-preview.element.test.ts +93 -0
- package/src/lib/file-input/file-input-preview/file-input-preview.element.ts +15 -13
- package/src/lib/file-input/file-input.element.test.ts +73 -0
- package/src/lib/file-input/file-input.element.ts +10 -20
- package/src/lib/in-page-nav/in-page-nav-item/in-page-nav-item.element.ts +20 -20
- package/src/lib/in-page-nav/{in-page-nav.test.ts → in-page-nav.element.test.ts} +18 -21
- package/src/lib/input/{input.test.ts → input.element.test.ts} +11 -0
- package/src/lib/input/input.element.ts +57 -41
- package/src/lib/input-mask/input-mask.element.ts +1 -1
- package/src/lib/input-mask/input-mask.stories.ts +2 -0
- package/src/lib/link/link.element.ts +18 -25
- package/src/lib/modal/modal-close/modal-close.element.test.ts +13 -0
- package/src/lib/modal/modal-heading/modal-heading.element.test.ts +15 -0
- package/src/lib/modal/modal.element.test.ts +23 -0
- package/src/lib/pagination/pagination-item/pagination-item.element.ts +9 -6
- package/src/lib/pagination/pagination-no/pagination-no.element.ts +17 -17
- package/src/lib/pagination/pagination.element.test.ts +13 -0
- package/src/lib/process-list/{process-list.test.ts → process-list.element.test.ts} +19 -12
- package/src/lib/radio/radio-option/radio-option.element.test.ts +20 -0
- package/src/lib/radio/radio.element.test.ts +121 -0
- package/src/lib/range-slider/range-slider.element.test.ts +57 -0
- package/src/lib/range-slider/range-slider.element.ts +48 -33
- package/src/lib/search/search.element.test.ts +71 -0
- package/src/lib/select/{select.test.ts → select.element.test.ts} +23 -26
- package/src/lib/select/select.element.ts +31 -32
- package/src/lib/side-nav/{side-nav.test.ts → side-nav.element.test.ts} +13 -23
- package/src/lib/step-indicator/step/step.element.ts +16 -16
- package/src/lib/step-indicator/{step-indicator.test.ts → step-indicator.element.test.ts} +6 -6
- package/src/lib/summary-box/summary-box.element.test.ts +13 -0
- package/src/lib/tag/tag.element.test.ts +13 -0
- package/src/lib/textarea/{textarea.test.ts → textarea.element.test.ts} +13 -13
- package/src/lib/textarea/textarea.element.ts +23 -24
- package/target/lib/accordion/accordion.element.js +4 -2
- package/target/lib/accordion/accordion.element.js.map +1 -1
- package/target/lib/accordion/accordion.element.test.d.ts +1 -0
- package/target/lib/accordion/{accordion.test.js → accordion.element.test.js} +19 -19
- package/target/lib/accordion/accordion.element.test.js.map +1 -0
- package/target/lib/alert/alert.element.js +4 -2
- package/target/lib/alert/alert.element.js.map +1 -1
- package/target/lib/alert/alert.element.test.d.ts +1 -0
- package/target/lib/alert/{alert.test.js → alert.element.test.js} +5 -5
- package/target/lib/alert/alert.element.test.js.map +1 -0
- package/target/lib/breadcrumbs/breadcrumb/breadcrumb.element.d.ts +1 -1
- package/target/lib/breadcrumbs/breadcrumb/breadcrumb.element.js +6 -6
- package/target/lib/breadcrumbs/breadcrumbs.element.test.d.ts +2 -0
- package/target/lib/breadcrumbs/{breadcrumbs.test.js → breadcrumbs.element.test.js} +6 -6
- package/target/lib/breadcrumbs/breadcrumbs.element.test.js.map +1 -0
- package/target/lib/button/button.element.d.ts +3 -3
- package/target/lib/button/button.element.js +17 -23
- package/target/lib/button/button.element.js.map +1 -1
- package/target/lib/button/button.element.test.d.ts +1 -0
- package/target/lib/button/button.element.test.js +12 -0
- package/target/lib/button/button.element.test.js.map +1 -0
- package/target/lib/button-group/button-group.element.test.d.ts +1 -0
- package/target/lib/button-group/button-group.element.test.js +9 -0
- package/target/lib/button-group/button-group.element.test.js.map +1 -0
- package/target/lib/card/card.element.test.d.ts +6 -0
- package/target/lib/card/{card.test.js → card.element.test.js} +10 -10
- package/target/lib/card/card.element.test.js.map +1 -0
- package/target/lib/checkbox/checkbox.element.d.ts +3 -2
- package/target/lib/checkbox/checkbox.element.js +21 -22
- package/target/lib/checkbox/checkbox.element.js.map +1 -1
- package/target/lib/checkbox/checkbox.element.test.d.ts +1 -0
- package/target/lib/checkbox/{checkbox.test.js → checkbox.element.test.js} +13 -12
- package/target/lib/checkbox/checkbox.element.test.js.map +1 -0
- package/target/lib/checkbox/checkbox.stories.d.ts +2 -2
- package/target/lib/checkbox/checkbox.stories.js +6 -6
- package/target/lib/checkbox/checkbox.stories.js.map +1 -1
- package/target/lib/collection/collection-item/collection-item.element.test.d.ts +1 -0
- package/target/lib/collection/collection-item/collection-item.element.test.js +9 -0
- package/target/lib/collection/collection-item/collection-item.element.test.js.map +1 -0
- package/target/lib/collection/collection.element.test.d.ts +1 -0
- package/target/lib/collection/collection.element.test.js +9 -0
- package/target/lib/collection/collection.element.test.js.map +1 -0
- package/target/lib/combo-box/combo-box.element.test.d.ts +3 -0
- package/target/lib/combo-box/{combo-box.test.js → combo-box.element.test.js} +60 -60
- package/target/lib/combo-box/combo-box.element.test.js.map +1 -0
- package/target/lib/config/config.element.test.d.ts +1 -0
- package/target/lib/config/config.element.test.js +9 -0
- package/target/lib/config/config.element.test.js.map +1 -0
- package/target/lib/description/description.element.test.d.ts +1 -0
- package/target/lib/description/description.element.test.js +9 -0
- package/target/lib/description/description.element.test.js.map +1 -0
- package/target/lib/file-input/file-input-preview/file-input-preview.element.js +12 -10
- package/target/lib/file-input/file-input-preview/file-input-preview.element.js.map +1 -1
- package/target/lib/file-input/file-input-preview/file-input-preview.element.test.d.ts +2 -0
- package/target/lib/file-input/file-input-preview/{file-input-preview.test.js → file-input-preview.element.test.js} +24 -24
- package/target/lib/file-input/file-input-preview/file-input-preview.element.test.js.map +1 -0
- package/target/lib/file-input/file-input.element.js +5 -6
- package/target/lib/file-input/file-input.element.js.map +1 -1
- package/target/lib/file-input/file-input.element.test.d.ts +1 -0
- package/target/lib/file-input/{file-input.test.js → file-input.element.test.js} +16 -16
- package/target/lib/file-input/file-input.element.test.js.map +1 -0
- package/target/lib/in-page-nav/in-page-nav-item/in-page-nav-item.element.d.ts +2 -3
- package/target/lib/in-page-nav/in-page-nav-item/in-page-nav-item.element.js +15 -13
- package/target/lib/in-page-nav/in-page-nav-item/in-page-nav-item.element.js.map +1 -1
- package/target/lib/in-page-nav/in-page-nav.element.test.d.ts +2 -0
- package/target/lib/in-page-nav/{in-page-nav.test.js → in-page-nav.element.test.js} +6 -6
- package/target/lib/in-page-nav/in-page-nav.element.test.js.map +1 -0
- package/target/lib/input/input.element.d.ts +4 -5
- package/target/lib/input/input.element.js +54 -48
- package/target/lib/input/input.element.js.map +1 -1
- package/target/lib/input/{input.test.js → input.element.test.js} +6 -1
- package/target/lib/input/input.element.test.js.map +1 -0
- package/target/lib/input-mask/input-mask.element.d.ts +1 -1
- package/target/lib/input-mask/input-mask.element.js +1 -1
- package/target/lib/input-mask/input-mask.element.js.map +1 -1
- package/target/lib/input-mask/{input-mask.test.js → input-mask.element.test.js} +1 -1
- package/target/lib/input-mask/input-mask.element.test.js.map +1 -0
- package/target/lib/input-mask/input-mask.stories.js +1 -1
- package/target/lib/input-mask/input-mask.stories.js.map +1 -1
- package/target/lib/link/link.element.d.ts +3 -5
- package/target/lib/link/link.element.js +14 -26
- package/target/lib/link/link.element.js.map +1 -1
- package/target/lib/modal/modal-close/modal-close.element.test.d.ts +1 -0
- package/target/lib/modal/modal-close/modal-close.element.test.js +9 -0
- package/target/lib/modal/modal-close/modal-close.element.test.js.map +1 -0
- package/target/lib/modal/modal-heading/modal-heading.element.test.d.ts +1 -0
- package/target/lib/modal/modal-heading/modal-heading.element.test.js +9 -0
- package/target/lib/modal/modal-heading/modal-heading.element.test.js.map +1 -0
- package/target/lib/modal/modal.element.test.d.ts +3 -0
- package/target/lib/modal/modal.element.test.js +11 -0
- package/target/lib/modal/modal.element.test.js.map +1 -0
- package/target/lib/pagination/pagination-item/pagination-item.element.d.ts +1 -1
- package/target/lib/pagination/pagination-item/pagination-item.element.js +3 -3
- package/target/lib/pagination/pagination-item/pagination-item.element.js.map +1 -1
- package/target/lib/pagination/pagination-no/pagination-no.element.d.ts +2 -3
- package/target/lib/pagination/pagination-no/pagination-no.element.js +10 -8
- package/target/lib/pagination/pagination-no/pagination-no.element.js.map +1 -1
- package/target/lib/pagination/pagination.element.test.d.ts +1 -0
- package/target/lib/pagination/pagination.element.test.js +9 -0
- package/target/lib/pagination/pagination.element.test.js.map +1 -0
- package/target/lib/process-list/process-list.element.test.d.ts +2 -0
- package/target/lib/process-list/{process-list.test.js → process-list.element.test.js} +6 -6
- package/target/lib/process-list/process-list.element.test.js.map +1 -0
- package/target/lib/radio/radio-option/radio-option.element.test.d.ts +2 -0
- package/target/lib/radio/radio-option/radio-option.element.test.js +11 -0
- package/target/lib/radio/radio-option/radio-option.element.test.js.map +1 -0
- package/target/lib/radio/radio.element.test.d.ts +2 -0
- package/target/lib/radio/{radio.test.js → radio.element.test.js} +19 -28
- package/target/lib/radio/radio.element.test.js.map +1 -0
- package/target/lib/range-slider/range-slider.element.d.ts +4 -2
- package/target/lib/range-slider/range-slider.element.js +34 -29
- package/target/lib/range-slider/range-slider.element.js.map +1 -1
- package/target/lib/range-slider/range-slider.element.test.d.ts +1 -0
- package/target/lib/range-slider/range-slider.element.test.js +26 -0
- package/target/lib/range-slider/range-slider.element.test.js.map +1 -0
- package/target/lib/search/search.element.test.d.ts +3 -0
- package/target/lib/search/search.element.test.js +52 -0
- package/target/lib/search/search.element.test.js.map +1 -0
- package/target/lib/select/select.element.d.ts +4 -3
- package/target/lib/select/select.element.js +25 -26
- package/target/lib/select/select.element.js.map +1 -1
- package/target/lib/select/select.element.test.d.ts +2 -0
- package/target/lib/select/{select.test.js → select.element.test.js} +23 -27
- package/target/lib/select/select.element.test.js.map +1 -0
- package/target/lib/services/{icon.service.test.js → icon.service.element.test.js} +1 -1
- package/target/lib/services/icon.service.element.test.js.map +1 -0
- package/target/lib/side-nav/side-nav.element.test.d.ts +3 -0
- package/target/lib/side-nav/{side-nav.test.js → side-nav.element.test.js} +11 -11
- package/target/lib/side-nav/side-nav.element.test.js.map +1 -0
- package/target/lib/step-indicator/step/step.element.d.ts +2 -2
- package/target/lib/step-indicator/step/step.element.js +8 -8
- package/target/lib/step-indicator/step-indicator.element.test.d.ts +2 -0
- package/target/lib/step-indicator/{step-indicator.test.js → step-indicator.element.test.js} +6 -6
- package/target/lib/step-indicator/step-indicator.element.test.js.map +1 -0
- package/target/lib/summary-box/summary-box.element.test.d.ts +1 -0
- package/target/lib/summary-box/summary-box.element.test.js +9 -0
- package/target/lib/summary-box/summary-box.element.test.js.map +1 -0
- package/target/lib/tag/tag.element.test.d.ts +1 -0
- package/target/lib/tag/tag.element.test.js +9 -0
- package/target/lib/tag/tag.element.test.js.map +1 -0
- package/target/lib/textarea/textarea.element.d.ts +2 -2
- package/target/lib/textarea/textarea.element.js +19 -24
- package/target/lib/textarea/textarea.element.js.map +1 -1
- package/target/lib/textarea/textarea.element.test.d.ts +1 -0
- package/target/lib/textarea/{textarea.test.js → textarea.element.test.js} +14 -14
- package/target/lib/textarea/textarea.element.test.js.map +1 -0
- package/src/lib/breadcrumbs/breadcrumbs.test.ts +0 -21
- package/src/lib/button/button.test.ts +0 -17
- package/src/lib/button-group/button-group.test.ts +0 -15
- package/src/lib/collection/collection-item/collection-item.test.ts +0 -15
- package/src/lib/collection/collection.test.ts +0 -15
- package/src/lib/config/config.test.ts +0 -15
- package/src/lib/description/description.test.ts +0 -15
- package/src/lib/file-input/file-input-preview/file-input-preview.test.ts +0 -95
- package/src/lib/file-input/file-input.test.ts +0 -79
- package/src/lib/modal/modal-close/modal-close.test.ts +0 -15
- package/src/lib/modal/modal-heading/modal-heading.test.ts +0 -15
- package/src/lib/modal/modal.test.ts +0 -25
- package/src/lib/pagination/pagination.test.ts +0 -15
- package/src/lib/radio/radio-option/radio-option.test.ts +0 -20
- package/src/lib/radio/radio.test.ts +0 -174
- package/src/lib/range-slider/range-slider.test.ts +0 -52
- package/src/lib/search/search.test.ts +0 -81
- package/src/lib/summary-box/summary-box.test.ts +0 -15
- package/src/lib/tag/tag.test.ts +0 -15
- package/target/lib/accordion/accordion.test.d.ts +0 -1
- package/target/lib/accordion/accordion.test.js.map +0 -1
- package/target/lib/alert/alert.test.d.ts +0 -1
- package/target/lib/alert/alert.test.js.map +0 -1
- package/target/lib/breadcrumbs/breadcrumbs.test.d.ts +0 -2
- package/target/lib/breadcrumbs/breadcrumbs.test.js.map +0 -1
- package/target/lib/button/button.test.d.ts +0 -1
- package/target/lib/button/button.test.js +0 -12
- package/target/lib/button/button.test.js.map +0 -1
- package/target/lib/button-group/button-group.test.d.ts +0 -1
- package/target/lib/button-group/button-group.test.js +0 -9
- package/target/lib/button-group/button-group.test.js.map +0 -1
- package/target/lib/card/card.test.d.ts +0 -6
- package/target/lib/card/card.test.js.map +0 -1
- package/target/lib/checkbox/checkbox.test.d.ts +0 -1
- package/target/lib/checkbox/checkbox.test.js.map +0 -1
- package/target/lib/collection/collection-item/collection-item.test.d.ts +0 -1
- package/target/lib/collection/collection-item/collection-item.test.js +0 -9
- package/target/lib/collection/collection-item/collection-item.test.js.map +0 -1
- package/target/lib/collection/collection.test.d.ts +0 -1
- package/target/lib/collection/collection.test.js +0 -9
- package/target/lib/collection/collection.test.js.map +0 -1
- package/target/lib/combo-box/combo-box.test.d.ts +0 -3
- package/target/lib/combo-box/combo-box.test.js.map +0 -1
- package/target/lib/config/config.test.d.ts +0 -1
- package/target/lib/config/config.test.js +0 -9
- package/target/lib/config/config.test.js.map +0 -1
- package/target/lib/description/description.test.d.ts +0 -1
- package/target/lib/description/description.test.js +0 -9
- package/target/lib/description/description.test.js.map +0 -1
- package/target/lib/file-input/file-input-preview/file-input-preview.test.d.ts +0 -2
- package/target/lib/file-input/file-input-preview/file-input-preview.test.js.map +0 -1
- package/target/lib/file-input/file-input.test.d.ts +0 -1
- package/target/lib/file-input/file-input.test.js.map +0 -1
- package/target/lib/in-page-nav/in-page-nav.test.d.ts +0 -2
- package/target/lib/in-page-nav/in-page-nav.test.js.map +0 -1
- package/target/lib/input/input.test.js.map +0 -1
- package/target/lib/input-mask/input-mask.test.js.map +0 -1
- package/target/lib/modal/modal-close/modal-close.test.d.ts +0 -1
- package/target/lib/modal/modal-close/modal-close.test.js +0 -9
- package/target/lib/modal/modal-close/modal-close.test.js.map +0 -1
- package/target/lib/modal/modal-heading/modal-heading.test.d.ts +0 -1
- package/target/lib/modal/modal-heading/modal-heading.test.js +0 -9
- package/target/lib/modal/modal-heading/modal-heading.test.js.map +0 -1
- package/target/lib/modal/modal.test.d.ts +0 -3
- package/target/lib/modal/modal.test.js +0 -11
- package/target/lib/modal/modal.test.js.map +0 -1
- package/target/lib/pagination/pagination.test.d.ts +0 -1
- package/target/lib/pagination/pagination.test.js +0 -9
- package/target/lib/pagination/pagination.test.js.map +0 -1
- package/target/lib/process-list/process-list.test.d.ts +0 -2
- package/target/lib/process-list/process-list.test.js.map +0 -1
- package/target/lib/radio/radio-option/radio-option.test.d.ts +0 -2
- package/target/lib/radio/radio-option/radio-option.test.js +0 -11
- package/target/lib/radio/radio-option/radio-option.test.js.map +0 -1
- package/target/lib/radio/radio.test.d.ts +0 -2
- package/target/lib/radio/radio.test.js.map +0 -1
- package/target/lib/range-slider/range-slider.test.d.ts +0 -1
- package/target/lib/range-slider/range-slider.test.js +0 -25
- package/target/lib/range-slider/range-slider.test.js.map +0 -1
- package/target/lib/search/search.test.d.ts +0 -3
- package/target/lib/search/search.test.js +0 -52
- package/target/lib/search/search.test.js.map +0 -1
- package/target/lib/select/select.test.d.ts +0 -2
- package/target/lib/select/select.test.js.map +0 -1
- package/target/lib/services/icon.service.test.js.map +0 -1
- package/target/lib/side-nav/side-nav.test.d.ts +0 -3
- package/target/lib/side-nav/side-nav.test.js.map +0 -1
- package/target/lib/step-indicator/step-indicator.test.d.ts +0 -2
- package/target/lib/step-indicator/step-indicator.test.js.map +0 -1
- package/target/lib/summary-box/summary-box.test.d.ts +0 -1
- package/target/lib/summary-box/summary-box.test.js +0 -9
- package/target/lib/summary-box/summary-box.test.js.map +0 -1
- package/target/lib/tag/tag.test.d.ts +0 -1
- package/target/lib/tag/tag.test.js +0 -9
- package/target/lib/tag/tag.test.js.map +0 -1
- package/target/lib/textarea/textarea.test.d.ts +0 -1
- package/target/lib/textarea/textarea.test.js.map +0 -1
- /package/src/lib/input-mask/{input-mask.test.ts → input-mask.element.test.ts} +0 -0
- /package/src/lib/services/{icon.service.test.ts → icon.service.element.test.ts} +0 -0
- /package/target/lib/input/{input.test.d.ts → input.element.test.d.ts} +0 -0
- /package/target/lib/input-mask/{input-mask.test.d.ts → input-mask.element.test.d.ts} +0 -0
- /package/target/lib/services/{icon.service.test.d.ts → icon.service.element.test.d.ts} +0 -0
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '@joist/templating/define.js';
|
|
2
|
+
|
|
3
|
+
import { attr, css, element, html, query } from '@joist/element';
|
|
4
|
+
import { bind } from '@joist/templating';
|
|
2
5
|
|
|
3
6
|
declare global {
|
|
4
7
|
interface HTMLElementTagNameMap {
|
|
5
|
-
|
|
8
|
+
'usa-link': USALinkElement;
|
|
6
9
|
}
|
|
7
10
|
}
|
|
8
11
|
|
|
9
12
|
@element({
|
|
10
|
-
tagName:
|
|
13
|
+
tagName: 'usa-link',
|
|
11
14
|
shadowDom: [
|
|
12
15
|
css`
|
|
13
16
|
:host {
|
|
@@ -20,38 +23,28 @@ declare global {
|
|
|
20
23
|
color: inherit;
|
|
21
24
|
text-decoration: inherit;
|
|
22
25
|
display: inherit;
|
|
23
|
-
text-overflow: inherit
|
|
26
|
+
text-overflow: inherit;
|
|
24
27
|
}
|
|
25
28
|
`,
|
|
26
29
|
html`
|
|
27
|
-
<
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
+
<j-bind props="href,target,title">
|
|
31
|
+
<a>
|
|
32
|
+
<slot></slot>
|
|
33
|
+
</a>
|
|
34
|
+
</j-bind>
|
|
30
35
|
`,
|
|
31
36
|
],
|
|
32
37
|
})
|
|
33
38
|
export class USALinkElement extends HTMLElement {
|
|
34
39
|
@attr()
|
|
35
|
-
|
|
40
|
+
@bind()
|
|
41
|
+
accessor href = '';
|
|
36
42
|
|
|
37
43
|
@attr()
|
|
38
|
-
|
|
44
|
+
@bind()
|
|
45
|
+
accessor target: '_blank' | '_parent' | '_self' | '_top' | '' = '';
|
|
39
46
|
|
|
40
47
|
@attr()
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
@attr({
|
|
44
|
-
observed: false,
|
|
45
|
-
})
|
|
46
|
-
accessor disabled = false;
|
|
47
|
-
|
|
48
|
-
#anchor = query("a");
|
|
49
|
-
|
|
50
|
-
attributeChangedCallback() {
|
|
51
|
-
this.#anchor({
|
|
52
|
-
href: this.href,
|
|
53
|
-
target: this.target,
|
|
54
|
-
title: this.title,
|
|
55
|
-
});
|
|
56
|
-
}
|
|
48
|
+
@bind()
|
|
49
|
+
accessor title = '';
|
|
57
50
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import './modal-close.element.js';
|
|
2
|
+
|
|
3
|
+
import { assert, fixture, html } from '@open-wc/testing';
|
|
4
|
+
|
|
5
|
+
import type { USAModalCloseElement } from './modal-close.element.js';
|
|
6
|
+
|
|
7
|
+
describe('usa-modal-close', () => {
|
|
8
|
+
it('should be accessible', async () => {
|
|
9
|
+
const modalClose = await fixture<USAModalCloseElement>(html` <usa-modal-close>Hello World</usa-modal-close> `);
|
|
10
|
+
|
|
11
|
+
return assert.isAccessible(modalClose);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import './modal-heading.element.js';
|
|
2
|
+
|
|
3
|
+
import { assert, fixture, html } from '@open-wc/testing';
|
|
4
|
+
|
|
5
|
+
import type { USAModalHeadingElement } from './modal-heading.element.js';
|
|
6
|
+
|
|
7
|
+
describe('usa-modal-heading', () => {
|
|
8
|
+
it('should be accessible', async () => {
|
|
9
|
+
const modalHeading = await fixture<USAModalHeadingElement>(html`
|
|
10
|
+
<usa-modal-heading>Hello World</usa-modal-heading>
|
|
11
|
+
`);
|
|
12
|
+
|
|
13
|
+
return assert.isAccessible(modalHeading);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import './modal.element.js';
|
|
2
|
+
import './modal-heading/modal-heading.element.js';
|
|
3
|
+
import './modal-close/modal-close.element.js';
|
|
4
|
+
|
|
5
|
+
import { assert, fixture, html } from '@open-wc/testing';
|
|
6
|
+
|
|
7
|
+
import type { USAModalElement } from './modal.element.js';
|
|
8
|
+
|
|
9
|
+
describe('usa-modal', () => {
|
|
10
|
+
it('should be accessible', async () => {
|
|
11
|
+
const modal = await fixture<USAModalElement>(html`
|
|
12
|
+
<usa-modal open>
|
|
13
|
+
<usa-modal-close></usa-modal-close>
|
|
14
|
+
|
|
15
|
+
<usa-modal-heading> Are you sure you want to continue? </usa-modal-heading>
|
|
16
|
+
|
|
17
|
+
<p>This is some other example of content</p>
|
|
18
|
+
</usa-modal>
|
|
19
|
+
`);
|
|
20
|
+
|
|
21
|
+
return assert.isAccessible(modal);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { css, element, html } from
|
|
1
|
+
import { css, element, html } from '@joist/element';
|
|
2
2
|
|
|
3
3
|
declare global {
|
|
4
4
|
interface HTMLElementTagNameMap {
|
|
5
|
-
|
|
5
|
+
'usa-pagination-item': USAPaginationItemElement;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
@element({
|
|
10
|
-
tagName:
|
|
10
|
+
tagName: 'usa-pagination-item',
|
|
11
11
|
shadowDom: [
|
|
12
12
|
css`
|
|
13
13
|
:host {
|
|
@@ -26,10 +26,13 @@ declare global {
|
|
|
26
26
|
:host(:last-child) {
|
|
27
27
|
margin-left: 1rem;
|
|
28
28
|
}
|
|
29
|
+
|
|
30
|
+
::slotted(usa-link) {
|
|
31
|
+
display: inline-flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
}
|
|
29
34
|
`,
|
|
30
|
-
html`
|
|
31
|
-
<slot></slot>
|
|
32
|
-
`,
|
|
35
|
+
html` <slot></slot> `,
|
|
33
36
|
],
|
|
34
37
|
})
|
|
35
38
|
export class USAPaginationItemElement extends HTMLElement {}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '@joist/templating/define.js';
|
|
2
|
+
|
|
3
|
+
import { attr, css, element, html } from '@joist/element';
|
|
4
|
+
import { bind } from '@joist/templating';
|
|
2
5
|
|
|
3
6
|
declare global {
|
|
4
7
|
interface HTMLElementTagNameMap {
|
|
5
|
-
|
|
8
|
+
'usa-pagination-no': USAPaginationNoElement;
|
|
6
9
|
}
|
|
7
10
|
}
|
|
8
11
|
|
|
9
12
|
@element({
|
|
10
|
-
tagName:
|
|
13
|
+
tagName: 'usa-pagination-no',
|
|
11
14
|
shadowDom: [
|
|
12
15
|
css`
|
|
13
16
|
:host {
|
|
14
17
|
align-items: center;
|
|
15
|
-
border-color: rgba(27, 27, 27, .2);
|
|
16
|
-
border-radius: .25rem;
|
|
18
|
+
border-color: rgba(27, 27, 27, 0.2);
|
|
19
|
+
border-radius: 0.25rem;
|
|
17
20
|
border-style: solid;
|
|
18
21
|
border-width: 1px;
|
|
19
22
|
color: #005ea2;
|
|
@@ -27,7 +30,7 @@ declare global {
|
|
|
27
30
|
justify-content: center;
|
|
28
31
|
text-decoration: underline;
|
|
29
32
|
cursor: pointer;
|
|
30
|
-
padding: .5rem;
|
|
33
|
+
padding: 0.5rem;
|
|
31
34
|
color: inherit;
|
|
32
35
|
}
|
|
33
36
|
|
|
@@ -35,25 +38,22 @@ declare global {
|
|
|
35
38
|
background-color: #1b1b1b;
|
|
36
39
|
border-color: transparent;
|
|
37
40
|
color: #fff;
|
|
38
|
-
}
|
|
41
|
+
}
|
|
39
42
|
`,
|
|
40
43
|
html`
|
|
41
|
-
<
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
+
<j-bind props="href">
|
|
45
|
+
<a>
|
|
46
|
+
<slot></slot>
|
|
47
|
+
</a>
|
|
48
|
+
</j-bind>
|
|
44
49
|
`,
|
|
45
50
|
],
|
|
46
51
|
})
|
|
47
52
|
export class USAPaginationNoElement extends HTMLElement {
|
|
48
53
|
@attr()
|
|
49
|
-
|
|
54
|
+
@bind()
|
|
55
|
+
accessor href = '#';
|
|
50
56
|
|
|
51
57
|
@attr()
|
|
52
58
|
accessor active = false;
|
|
53
|
-
|
|
54
|
-
#a = query("a");
|
|
55
|
-
|
|
56
|
-
attributeChangedCallback() {
|
|
57
|
-
this.#a({ href: this.href });
|
|
58
|
-
}
|
|
59
59
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import './pagination.element.js';
|
|
2
|
+
|
|
3
|
+
import { assert, fixture, html } from '@open-wc/testing';
|
|
4
|
+
|
|
5
|
+
import type { USAPaginationElement } from './pagination.element.js';
|
|
6
|
+
|
|
7
|
+
describe('usa-pagination', () => {
|
|
8
|
+
it('should be accessible', async () => {
|
|
9
|
+
const pagination = await fixture<USAPaginationElement>(html` <usa-pagination>Hello World</usa-pagination> `);
|
|
10
|
+
|
|
11
|
+
return assert.isAccessible(pagination);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import './process-list.element.js';
|
|
2
|
+
import './process-list-item/process-list-item.element.js';
|
|
3
3
|
|
|
4
|
-
import { assert, fixture, html } from
|
|
4
|
+
import { assert, fixture, html } from '@open-wc/testing';
|
|
5
5
|
|
|
6
|
-
import type { USAProcessListElement } from
|
|
6
|
+
import type { USAProcessListElement } from './process-list.element.js';
|
|
7
7
|
|
|
8
|
-
describe(
|
|
9
|
-
it(
|
|
8
|
+
describe('usa-process-list', () => {
|
|
9
|
+
it('should be accessible', async () => {
|
|
10
10
|
const processList = await fixture<USAProcessListElement>(html`
|
|
11
11
|
<usa-process-list>
|
|
12
12
|
<usa-process-list-item>
|
|
13
13
|
<h4 slot="title">Start a process</h4>
|
|
14
14
|
|
|
15
|
-
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra gravida, orci
|
|
15
|
+
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra gravida, orci
|
|
16
|
+
magna rhoncus neque.
|
|
16
17
|
|
|
17
18
|
<ul>
|
|
18
19
|
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
|
|
19
|
-
<li>
|
|
20
|
+
<li>
|
|
21
|
+
Morbi commodo, ipsum sed pharetra gravida, orci magna rhoncus neque, id pulvinar odio lorem non turpis.
|
|
22
|
+
</li>
|
|
20
23
|
<li>Nullam sit amet enim. Suspendisse id velit vitae ligula volutpat condimentum.</li>
|
|
21
24
|
<li>Aliquam erat volutpat. Sed quis velit.</li>
|
|
22
25
|
</ul>
|
|
@@ -24,14 +27,18 @@ describe("usa-process-list", () => {
|
|
|
24
27
|
|
|
25
28
|
<usa-process-list-item>
|
|
26
29
|
<h4 slot="title">Proceed to the second step</h4>
|
|
27
|
-
|
|
28
|
-
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra gravida, orci
|
|
30
|
+
|
|
31
|
+
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra gravida, orci
|
|
32
|
+
magna rhoncus neque, id pulvinar odio lorem non turpis. Nullam sit amet enim. Suspendisse id velit vitae
|
|
33
|
+
ligula volutpat condimentum. Aliquam erat volutpat. Sed quis velit. Nulla facilisi. Nulla libero. Vivamus
|
|
34
|
+
pharetra posuere sapien.
|
|
29
35
|
</usa-process-list-item>
|
|
30
36
|
|
|
31
37
|
<usa-process-list-item>
|
|
32
38
|
<h4 slot="title">Complete the step-by-step process</h4>
|
|
33
|
-
|
|
34
|
-
Nullam sit amet enim. Suspendisse id velit vitae ligula volutpat condimentum. Aliquam erat volutpat. Sed quis
|
|
39
|
+
|
|
40
|
+
Nullam sit amet enim. Suspendisse id velit vitae ligula volutpat condimentum. Aliquam erat volutpat. Sed quis
|
|
41
|
+
velit. Nulla facilisi. Nulla libero. Vivamus pharetra posuere sapien.
|
|
35
42
|
</usa-process-list-item>
|
|
36
43
|
</usa-process-list>
|
|
37
44
|
`);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import '../radio.element.js';
|
|
2
|
+
import './radio-option.element.js';
|
|
3
|
+
|
|
4
|
+
import { assert, fixture, html } from '@open-wc/testing';
|
|
5
|
+
|
|
6
|
+
import type { USARadioOptionElement } from './radio-option.element.js';
|
|
7
|
+
|
|
8
|
+
describe('usa-radio-option', () => {
|
|
9
|
+
it('should map value to slot', async () => {
|
|
10
|
+
const radio = await fixture<USARadioOptionElement>(html`
|
|
11
|
+
<usa-radio>
|
|
12
|
+
<usa-radio-option value="first">First</usa-radio-option>
|
|
13
|
+
</usa-radio>
|
|
14
|
+
`);
|
|
15
|
+
|
|
16
|
+
const option = radio.querySelectorAll('usa-radio-option');
|
|
17
|
+
|
|
18
|
+
assert.equal(option[0].value, option[0].slot);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import './radio.element.js';
|
|
2
|
+
import './radio-option/radio-option.element.js';
|
|
3
|
+
|
|
4
|
+
import { assert, fixture, html } from '@open-wc/testing';
|
|
5
|
+
|
|
6
|
+
import type { USARadioElement } from './radio.element.js';
|
|
7
|
+
|
|
8
|
+
describe('usa-radio', () => {
|
|
9
|
+
it('should be accessible', async () => {
|
|
10
|
+
const radio = await fixture<USARadioElement>(html`
|
|
11
|
+
<usa-radio name="historical-figures" value="frederick-douglass" tiled>
|
|
12
|
+
<usa-radio-option value="sojourner-truth"> Sojourner Truth </usa-radio-option>
|
|
13
|
+
|
|
14
|
+
<usa-radio-option value="frederick-douglass"> Frederick Douglass </usa-radio-option>
|
|
15
|
+
|
|
16
|
+
<usa-radio-option value="booker-t-washington"> Booker T. Washington </usa-radio-option>
|
|
17
|
+
|
|
18
|
+
<usa-radio-option value="george-washington-carver"> George Washington Carver </usa-radio-option>
|
|
19
|
+
</usa-radio>
|
|
20
|
+
`);
|
|
21
|
+
|
|
22
|
+
return assert.isAccessible(radio);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('should create local inputs for each option', async () => {
|
|
26
|
+
const form = await fixture<HTMLFormElement>(html`
|
|
27
|
+
<form>
|
|
28
|
+
<usa-radio name="historical-figures" value="frederick-douglass">
|
|
29
|
+
<usa-radio-option value="sojourner-truth"> Sojourner Truth </usa-radio-option>
|
|
30
|
+
|
|
31
|
+
<usa-radio-option value="frederick-douglass"> Frederick Douglass </usa-radio-option>
|
|
32
|
+
|
|
33
|
+
<usa-radio-option value="booker-t-washington"> Booker T. Washington </usa-radio-option>
|
|
34
|
+
|
|
35
|
+
<usa-radio-option value="george-washington-carver"> George Washington Carver </usa-radio-option>
|
|
36
|
+
</usa-radio>
|
|
37
|
+
</form>
|
|
38
|
+
`);
|
|
39
|
+
|
|
40
|
+
const nativeInputs = form.querySelector('usa-radio')?.shadowRoot?.querySelectorAll('input') ?? [];
|
|
41
|
+
|
|
42
|
+
assert.deepEqual(
|
|
43
|
+
Array.from(nativeInputs).map((input) => input.value),
|
|
44
|
+
['sojourner-truth', 'frederick-douglass', 'booker-t-washington', 'george-washington-carver'],
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('should remove inputs when options are removed', async () => {
|
|
49
|
+
const form = await fixture<HTMLFormElement>(html`
|
|
50
|
+
<form>
|
|
51
|
+
<usa-radio name="historical-figures" value="frederick-douglass">
|
|
52
|
+
<usa-radio-option value="sojourner-truth"> Sojourner Truth </usa-radio-option>
|
|
53
|
+
|
|
54
|
+
<usa-radio-option value="frederick-douglass"> Frederick Douglass </usa-radio-option>
|
|
55
|
+
|
|
56
|
+
<usa-radio-option value="booker-t-washington"> Booker T. Washington </usa-radio-option>
|
|
57
|
+
|
|
58
|
+
<usa-radio-option value="george-washington-carver"> George Washington Carver </usa-radio-option>
|
|
59
|
+
</usa-radio>
|
|
60
|
+
</form>
|
|
61
|
+
`);
|
|
62
|
+
|
|
63
|
+
const options = form.querySelectorAll('usa-radio-option');
|
|
64
|
+
|
|
65
|
+
options[2].remove();
|
|
66
|
+
|
|
67
|
+
const nativeInputs = form.querySelector('usa-radio')?.shadowRoot?.querySelectorAll('input') ?? [];
|
|
68
|
+
|
|
69
|
+
assert.deepEqual(
|
|
70
|
+
Array.from(nativeInputs).map((input) => input.value),
|
|
71
|
+
['sojourner-truth', 'frederick-douglass', 'george-washington-carver'],
|
|
72
|
+
);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('should submit form with default values', async () => {
|
|
76
|
+
const form = await fixture<HTMLFormElement>(html`
|
|
77
|
+
<form>
|
|
78
|
+
<usa-radio name="historical-figures" value="frederick-douglass">
|
|
79
|
+
<usa-radio-option value="sojourner-truth"> Sojourner Truth </usa-radio-option>
|
|
80
|
+
|
|
81
|
+
<usa-radio-option value="frederick-douglass"> Frederick Douglass </usa-radio-option>
|
|
82
|
+
|
|
83
|
+
<usa-radio-option value="booker-t-washington"> Booker T. Washington </usa-radio-option>
|
|
84
|
+
|
|
85
|
+
<usa-radio-option value="george-washington-carver"> George Washington Carver </usa-radio-option>
|
|
86
|
+
</usa-radio>
|
|
87
|
+
</form>
|
|
88
|
+
`);
|
|
89
|
+
|
|
90
|
+
const value = new FormData(form);
|
|
91
|
+
|
|
92
|
+
const nativeInputs = form.querySelector('usa-radio')?.shadowRoot?.querySelectorAll('input') ?? [];
|
|
93
|
+
|
|
94
|
+
assert.equal(nativeInputs[1].checked, true);
|
|
95
|
+
assert.equal(value.get('historical-figures'), 'frederick-douglass');
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('should submit form with changed value', async () => {
|
|
99
|
+
const form = await fixture<HTMLFormElement>(html`
|
|
100
|
+
<form>
|
|
101
|
+
<usa-radio name="historical-figures" value="frederick-douglass">
|
|
102
|
+
<usa-radio-option value="sojourner-truth"> Sojourner Truth </usa-radio-option>
|
|
103
|
+
|
|
104
|
+
<usa-radio-option value="frederick-douglass"> Frederick Douglass </usa-radio-option>
|
|
105
|
+
|
|
106
|
+
<usa-radio-option value="booker-t-washington"> Booker T. Washington </usa-radio-option>
|
|
107
|
+
|
|
108
|
+
<usa-radio-option value="george-washington-carver"> George Washington Carver </usa-radio-option>
|
|
109
|
+
</usa-radio>
|
|
110
|
+
</form>
|
|
111
|
+
`);
|
|
112
|
+
|
|
113
|
+
const nativeInputs = form.querySelector('usa-radio')?.shadowRoot?.querySelectorAll('input') ?? [];
|
|
114
|
+
|
|
115
|
+
nativeInputs[3].click();
|
|
116
|
+
|
|
117
|
+
const value = new FormData(form);
|
|
118
|
+
|
|
119
|
+
assert.equal(value.get('historical-figures'), 'george-washington-carver');
|
|
120
|
+
});
|
|
121
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import './range-slider.element.js';
|
|
2
|
+
|
|
3
|
+
import { assert, fixture, html } from '@open-wc/testing';
|
|
4
|
+
import { userEvent } from '@testing-library/user-event';
|
|
5
|
+
|
|
6
|
+
import type { USARangeSliderElement } from './range-slider.element.js';
|
|
7
|
+
|
|
8
|
+
describe('usa-range-slider', () => {
|
|
9
|
+
it('should be accessible', async () => {
|
|
10
|
+
const rangeSlider = await fixture<USARangeSliderElement>(html`
|
|
11
|
+
<usa-range-slider name="slider" value="0">Hello World</usa-range-slider>
|
|
12
|
+
`);
|
|
13
|
+
|
|
14
|
+
return assert.isAccessible(rangeSlider);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should submit form with default values', async () => {
|
|
18
|
+
const form = await fixture<HTMLFormElement>(html`
|
|
19
|
+
<form>
|
|
20
|
+
<usa-range-slider name="slider" value="50">Hello World</usa-range-slider>
|
|
21
|
+
|
|
22
|
+
<button>Submit</button>
|
|
23
|
+
</form>
|
|
24
|
+
`);
|
|
25
|
+
|
|
26
|
+
const value = new FormData(form);
|
|
27
|
+
|
|
28
|
+
assert.equal(value.get('slider'), '50');
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('should update form value as input value changed', async () => {
|
|
32
|
+
const form = await fixture<HTMLFormElement>(html`
|
|
33
|
+
<form>
|
|
34
|
+
<usa-range-slider name="slider" value="50">Hello World</usa-range-slider>
|
|
35
|
+
|
|
36
|
+
<button>Submit</button>
|
|
37
|
+
</form>
|
|
38
|
+
`);
|
|
39
|
+
|
|
40
|
+
const input = form.querySelector('usa-range-slider');
|
|
41
|
+
|
|
42
|
+
assert.ok(input?.shadowRoot);
|
|
43
|
+
|
|
44
|
+
const nativeInput = input.shadowRoot.querySelector('input');
|
|
45
|
+
|
|
46
|
+
assert.ok(nativeInput);
|
|
47
|
+
|
|
48
|
+
nativeInput.value = '75';
|
|
49
|
+
nativeInput.dispatchEvent(new Event('change', { bubbles: true }));
|
|
50
|
+
|
|
51
|
+
await Promise.resolve();
|
|
52
|
+
|
|
53
|
+
const value = new FormData(form);
|
|
54
|
+
|
|
55
|
+
assert.equal(value.get('slider'), '75');
|
|
56
|
+
});
|
|
57
|
+
});
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '@joist/templating/define.js';
|
|
2
|
+
|
|
3
|
+
import { attr, css, element, html, listen, query } from '@joist/element';
|
|
4
|
+
import { effect } from '@joist/observable';
|
|
5
|
+
import { bind } from '@joist/templating';
|
|
2
6
|
|
|
3
7
|
declare global {
|
|
4
8
|
interface HTMLElementTagNameMap {
|
|
5
|
-
|
|
9
|
+
'usa-range-slider': USARangeSliderElement;
|
|
6
10
|
}
|
|
7
11
|
}
|
|
8
12
|
|
|
9
13
|
@element({
|
|
10
|
-
tagName:
|
|
14
|
+
tagName: 'usa-range-slider',
|
|
11
15
|
shadowDom: [
|
|
12
16
|
css`
|
|
13
17
|
:host {
|
|
@@ -24,11 +28,11 @@ declare global {
|
|
|
24
28
|
border-radius: 0;
|
|
25
29
|
color: #1b1b1b;
|
|
26
30
|
display: block;
|
|
27
|
-
margin-top: .5rem;
|
|
31
|
+
margin-top: 0.5rem;
|
|
28
32
|
}
|
|
29
33
|
|
|
30
34
|
input:focus {
|
|
31
|
-
outline: .25rem solid #2491ff;
|
|
35
|
+
outline: 0.25rem solid #2491ff;
|
|
32
36
|
outline-offset: 0;
|
|
33
37
|
}
|
|
34
38
|
|
|
@@ -42,7 +46,7 @@ declare global {
|
|
|
42
46
|
cursor: pointer;
|
|
43
47
|
-webkit-appearance: none;
|
|
44
48
|
appearance: none;
|
|
45
|
-
margin-top:
|
|
49
|
+
margin-top: -0.19rem;
|
|
46
50
|
}
|
|
47
51
|
|
|
48
52
|
input::-webkit-slider-runnable-track {
|
|
@@ -55,11 +59,15 @@ declare global {
|
|
|
55
59
|
}
|
|
56
60
|
`,
|
|
57
61
|
html`
|
|
58
|
-
<
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
<j-bind attrs="for:name">
|
|
63
|
+
<label part="label">
|
|
64
|
+
<slot></slot>
|
|
65
|
+
</label>
|
|
66
|
+
</j-bind>
|
|
67
|
+
|
|
68
|
+
<j-bind props="id:name,name,value,min,max,step">
|
|
69
|
+
<input type="range" part="input" />
|
|
70
|
+
</j-bind>
|
|
63
71
|
`,
|
|
64
72
|
],
|
|
65
73
|
})
|
|
@@ -67,45 +75,52 @@ export class USARangeSliderElement extends HTMLElement {
|
|
|
67
75
|
static formAssociated = true;
|
|
68
76
|
|
|
69
77
|
@attr()
|
|
70
|
-
|
|
78
|
+
@bind()
|
|
79
|
+
accessor name = '';
|
|
71
80
|
|
|
72
81
|
@attr()
|
|
73
|
-
|
|
82
|
+
@bind()
|
|
83
|
+
accessor value = '0';
|
|
74
84
|
|
|
75
85
|
@attr()
|
|
76
|
-
|
|
86
|
+
@bind()
|
|
87
|
+
accessor min = '0';
|
|
77
88
|
|
|
78
89
|
@attr()
|
|
79
|
-
|
|
90
|
+
@bind()
|
|
91
|
+
accessor max = '100';
|
|
80
92
|
|
|
81
93
|
@attr()
|
|
82
|
-
|
|
94
|
+
@bind()
|
|
95
|
+
accessor step = '1';
|
|
83
96
|
|
|
84
|
-
#
|
|
85
|
-
#input = query("input");
|
|
97
|
+
#input = query('input');
|
|
86
98
|
#internals = this.attachInternals();
|
|
87
99
|
|
|
88
|
-
|
|
89
|
-
this.#
|
|
90
|
-
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
this.#input({
|
|
94
|
-
name: this.name,
|
|
95
|
-
value: this.value,
|
|
96
|
-
min: this.min,
|
|
97
|
-
max: this.max,
|
|
98
|
-
step: this.step,
|
|
99
|
-
id: this.name,
|
|
100
|
-
});
|
|
100
|
+
connectedCallback() {
|
|
101
|
+
this.#syncFormState();
|
|
102
|
+
}
|
|
101
103
|
|
|
102
|
-
|
|
104
|
+
@effect()
|
|
105
|
+
onChange() {
|
|
106
|
+
this.#syncFormState();
|
|
103
107
|
}
|
|
104
108
|
|
|
105
|
-
@listen(
|
|
109
|
+
@listen('change')
|
|
106
110
|
onInputChange() {
|
|
107
111
|
const input = this.#input();
|
|
108
112
|
|
|
109
113
|
this.value = input.value;
|
|
110
114
|
}
|
|
115
|
+
|
|
116
|
+
#syncFormState() {
|
|
117
|
+
const input = this.#input();
|
|
118
|
+
|
|
119
|
+
this.#internals.setValidity({});
|
|
120
|
+
this.#internals.setFormValue(this.value);
|
|
121
|
+
|
|
122
|
+
if (input.validationMessage) {
|
|
123
|
+
this.#internals.setValidity({ customError: true }, input.validationMessage, input);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
111
126
|
}
|