@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
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import './search.element.js';
|
|
2
|
+
import '../input/input.element.js';
|
|
3
|
+
import '../button/button.element.js';
|
|
4
|
+
|
|
5
|
+
import { assert, fixture, html } from '@open-wc/testing';
|
|
6
|
+
|
|
7
|
+
import { userEvent } from '@testing-library/user-event';
|
|
8
|
+
import type { USASearchElement } from './search.element.js';
|
|
9
|
+
|
|
10
|
+
describe('usa-search', () => {
|
|
11
|
+
it('should be accessible', async () => {
|
|
12
|
+
const search = await fixture<USASearchElement>(html` <usa-search name="search">Hello World</usa-search> `);
|
|
13
|
+
|
|
14
|
+
return assert.isAccessible(search);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should have default attribute values', async () => {
|
|
18
|
+
const search = await fixture<USASearchElement>(html` <usa-search></usa-search> `);
|
|
19
|
+
|
|
20
|
+
assert.equal(search.name, 'search');
|
|
21
|
+
assert.equal(search.placeholder, 'Search');
|
|
22
|
+
assert.equal(search.required, false);
|
|
23
|
+
assert.equal(search.disabled, false);
|
|
24
|
+
assert.equal(search.autocomplete, 'off');
|
|
25
|
+
assert.equal(search.value, '');
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('should update attributes when changed', async () => {
|
|
29
|
+
const search = await fixture<USASearchElement>(html` <usa-search></usa-search> `);
|
|
30
|
+
|
|
31
|
+
search.name = 'custom-name';
|
|
32
|
+
search.placeholder = 'Custom Placeholder';
|
|
33
|
+
search.required = true;
|
|
34
|
+
search.disabled = true;
|
|
35
|
+
search.autocomplete = 'on';
|
|
36
|
+
search.value = 'test value';
|
|
37
|
+
|
|
38
|
+
assert.equal(search.name, 'custom-name');
|
|
39
|
+
assert.equal(search.placeholder, 'Custom Placeholder');
|
|
40
|
+
assert.equal(search.required, true);
|
|
41
|
+
assert.equal(search.disabled, true);
|
|
42
|
+
assert.equal(search.autocomplete, 'on');
|
|
43
|
+
assert.equal(search.value, 'test value');
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('should handle form submission', async () => {
|
|
47
|
+
const search = await fixture<USASearchElement>(html` <usa-search></usa-search> `);
|
|
48
|
+
|
|
49
|
+
let submitted = false;
|
|
50
|
+
|
|
51
|
+
search.addEventListener('submit', (e) => {
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
|
|
54
|
+
submitted = true;
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const form = search.shadowRoot?.querySelector('form');
|
|
58
|
+
form?.dispatchEvent(new Event('submit', { bubbles: true, composed: true }));
|
|
59
|
+
|
|
60
|
+
assert.isTrue(submitted);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('should update value on input change', async () => {
|
|
64
|
+
const search = await fixture<USASearchElement>(html` <usa-search></usa-search> `);
|
|
65
|
+
|
|
66
|
+
const input = search.shadowRoot?.querySelector('usa-input');
|
|
67
|
+
input?.dispatchEvent(new Event('input', { bubbles: true }));
|
|
68
|
+
|
|
69
|
+
assert.equal(search.value, '');
|
|
70
|
+
});
|
|
71
|
+
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import './select.element.js';
|
|
2
|
+
import './select-option/select-option.element.js';
|
|
3
3
|
|
|
4
|
-
import { assert, fixture, html } from
|
|
5
|
-
import { userEvent } from
|
|
4
|
+
import { assert, fixture, html } from '@open-wc/testing';
|
|
5
|
+
import { userEvent } from '@testing-library/user-event';
|
|
6
6
|
|
|
7
|
-
describe(
|
|
8
|
-
it(
|
|
7
|
+
describe('usa-select', () => {
|
|
8
|
+
it('should be accessible', async () => {
|
|
9
9
|
const el = await fixture<HTMLFormElement>(html`
|
|
10
10
|
<usa-select name="example">
|
|
11
11
|
Hello World
|
|
@@ -19,7 +19,7 @@ describe("usa-select", () => {
|
|
|
19
19
|
return assert.isAccessible(el);
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
it(
|
|
22
|
+
it('should create local select options', async () => {
|
|
23
23
|
const form = await fixture<HTMLFormElement>(html`
|
|
24
24
|
<form>
|
|
25
25
|
<usa-select name="example">
|
|
@@ -32,17 +32,15 @@ describe("usa-select", () => {
|
|
|
32
32
|
</form>
|
|
33
33
|
`);
|
|
34
34
|
|
|
35
|
-
const nativeInputs = form
|
|
36
|
-
.querySelector("usa-select")
|
|
37
|
-
?.shadowRoot?.querySelectorAll("option");
|
|
35
|
+
const nativeInputs = form.querySelector('usa-select')?.shadowRoot?.querySelectorAll('option');
|
|
38
36
|
|
|
39
37
|
assert.deepEqual(
|
|
40
38
|
Array.from(nativeInputs ?? []).map((input) => input.value),
|
|
41
|
-
[
|
|
39
|
+
['first', 'second', 'third'],
|
|
42
40
|
);
|
|
43
41
|
});
|
|
44
42
|
|
|
45
|
-
it(
|
|
43
|
+
it('should remove select options when options are removed', async () => {
|
|
46
44
|
const form = await fixture<HTMLFormElement>(html`
|
|
47
45
|
<form>
|
|
48
46
|
<usa-select name="example">
|
|
@@ -55,21 +53,19 @@ describe("usa-select", () => {
|
|
|
55
53
|
</form>
|
|
56
54
|
`);
|
|
57
55
|
|
|
58
|
-
const options = form.querySelectorAll(
|
|
56
|
+
const options = form.querySelectorAll('usa-select-option');
|
|
59
57
|
|
|
60
58
|
options[1].remove();
|
|
61
59
|
|
|
62
|
-
const nativeInputs = form
|
|
63
|
-
.querySelector("usa-select")
|
|
64
|
-
?.shadowRoot?.querySelectorAll("option");
|
|
60
|
+
const nativeInputs = form.querySelector('usa-select')?.shadowRoot?.querySelectorAll('option');
|
|
65
61
|
|
|
66
62
|
assert.deepEqual(
|
|
67
63
|
Array.from(nativeInputs ?? []).map((input) => input.value),
|
|
68
|
-
[
|
|
64
|
+
['first', 'third'],
|
|
69
65
|
);
|
|
70
66
|
});
|
|
71
67
|
|
|
72
|
-
it(
|
|
68
|
+
it('should submit form with default values', async () => {
|
|
73
69
|
const form = await fixture<HTMLFormElement>(html`
|
|
74
70
|
<form>
|
|
75
71
|
<usa-select name="example" value="second">
|
|
@@ -84,10 +80,10 @@ describe("usa-select", () => {
|
|
|
84
80
|
|
|
85
81
|
const value = new FormData(form);
|
|
86
82
|
|
|
87
|
-
assert.equal(value.get(
|
|
83
|
+
assert.equal(value.get('example'), 'second');
|
|
88
84
|
});
|
|
89
85
|
|
|
90
|
-
it(
|
|
86
|
+
it('should update form value as select value changed', async () => {
|
|
91
87
|
const form = await fixture<HTMLFormElement>(html`
|
|
92
88
|
<form>
|
|
93
89
|
<usa-select name="example" value="second">
|
|
@@ -100,24 +96,25 @@ describe("usa-select", () => {
|
|
|
100
96
|
</form>
|
|
101
97
|
`);
|
|
102
98
|
|
|
103
|
-
const select = form.querySelector(
|
|
104
|
-
const nativeSelect = select?.shadowRoot?.querySelector(
|
|
99
|
+
const select = form.querySelector('usa-select');
|
|
100
|
+
const nativeSelect = select?.shadowRoot?.querySelector('select');
|
|
105
101
|
|
|
106
102
|
if (nativeSelect) {
|
|
107
|
-
await userEvent.selectOptions(nativeSelect,
|
|
103
|
+
await userEvent.selectOptions(nativeSelect, 'third');
|
|
108
104
|
}
|
|
109
105
|
|
|
110
106
|
const value = new FormData(form);
|
|
111
107
|
|
|
112
|
-
assert.equal(value.get(
|
|
108
|
+
assert.equal(value.get('example'), 'third');
|
|
113
109
|
});
|
|
114
110
|
|
|
115
|
-
it(
|
|
111
|
+
it('should not submit when not valid', async () => {
|
|
116
112
|
const form = await fixture<HTMLFormElement>(html`
|
|
117
113
|
<form>
|
|
118
|
-
<usa-select name="example" required>
|
|
114
|
+
<usa-select id="TEST" name="example" required>
|
|
119
115
|
Hello World
|
|
120
116
|
|
|
117
|
+
<usa-select-option value="">-Select One -</usa-select-option>
|
|
121
118
|
<usa-select-option value="first">First</usa-select-option>
|
|
122
119
|
<usa-select-option value="second">Second</usa-select-option>
|
|
123
120
|
<usa-select-option value="third">Third</usa-select-option>
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { attr, css, element, html, listen, query } from "@joist/element";
|
|
1
|
+
import '@joist/templating/define.js';
|
|
3
2
|
|
|
4
|
-
import {
|
|
3
|
+
import { injectable } from '@joist/di';
|
|
4
|
+
import { attr, css, element, html, listen, query } from '@joist/element';
|
|
5
|
+
import { bind } from '@joist/templating';
|
|
6
|
+
|
|
7
|
+
import { SELECT_CONTEXT, type SelectContainer } from './context.js';
|
|
8
|
+
import { effect } from '@joist/observable';
|
|
5
9
|
|
|
6
10
|
declare global {
|
|
7
11
|
interface HTMLElementTagNameMap {
|
|
8
|
-
|
|
12
|
+
'usa-select': USASelectElement;
|
|
9
13
|
}
|
|
10
14
|
}
|
|
11
15
|
|
|
12
16
|
@injectable({
|
|
13
|
-
name:
|
|
17
|
+
name: 'usa-select-ctx',
|
|
14
18
|
provideSelfAs: [SELECT_CONTEXT],
|
|
15
19
|
})
|
|
16
20
|
@element({
|
|
17
|
-
tagName:
|
|
21
|
+
tagName: 'usa-select',
|
|
18
22
|
shadowDom: [
|
|
19
23
|
css`
|
|
20
24
|
:host {
|
|
@@ -69,7 +73,9 @@ declare global {
|
|
|
69
73
|
<slot></slot>
|
|
70
74
|
</div>
|
|
71
75
|
|
|
72
|
-
<
|
|
76
|
+
<j-bind props="value,name,required">
|
|
77
|
+
<select part="select"></select>
|
|
78
|
+
</j-bind>
|
|
73
79
|
</label>
|
|
74
80
|
`,
|
|
75
81
|
],
|
|
@@ -78,63 +84,56 @@ export class USASelectElement extends HTMLElement implements SelectContainer {
|
|
|
78
84
|
static formAssociated = true;
|
|
79
85
|
|
|
80
86
|
@attr()
|
|
81
|
-
|
|
87
|
+
@bind()
|
|
88
|
+
accessor value = '';
|
|
82
89
|
|
|
83
90
|
@attr()
|
|
84
|
-
|
|
91
|
+
@bind()
|
|
92
|
+
accessor name = '';
|
|
85
93
|
|
|
86
94
|
@attr()
|
|
95
|
+
@bind()
|
|
87
96
|
accessor required = false;
|
|
88
97
|
|
|
89
|
-
#select = query(
|
|
98
|
+
#select = query('select');
|
|
90
99
|
#internals = this.attachInternals();
|
|
91
100
|
|
|
92
101
|
connectedCallback() {
|
|
93
|
-
this.#select({
|
|
94
|
-
value: this.value,
|
|
95
|
-
name: this.name,
|
|
96
|
-
required: this.required,
|
|
97
|
-
});
|
|
98
|
-
|
|
99
102
|
this.#syncFormState();
|
|
100
103
|
}
|
|
101
104
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
value: this.value,
|
|
105
|
-
name: this.name,
|
|
106
|
-
required: this.required,
|
|
107
|
-
});
|
|
108
|
-
|
|
105
|
+
@effect()
|
|
106
|
+
onChange() {
|
|
109
107
|
this.#syncFormState();
|
|
110
108
|
}
|
|
111
109
|
|
|
112
|
-
@listen(
|
|
110
|
+
@listen('change')
|
|
113
111
|
onSelectChange() {
|
|
114
112
|
const select = this.#select();
|
|
115
113
|
|
|
116
114
|
this.value = select.value;
|
|
117
|
-
|
|
118
|
-
this.#syncFormState();
|
|
119
115
|
}
|
|
120
116
|
|
|
121
117
|
addSelectOption(option: HTMLOptionElement) {
|
|
122
118
|
const select = this.#select();
|
|
119
|
+
|
|
120
|
+
if (!this.value && !select.children.length) {
|
|
121
|
+
this.value = option.value;
|
|
122
|
+
}
|
|
123
|
+
|
|
123
124
|
select.append(option);
|
|
124
125
|
}
|
|
125
126
|
|
|
126
|
-
#syncFormState() {
|
|
127
|
+
async #syncFormState() {
|
|
127
128
|
const select = this.#select();
|
|
128
129
|
|
|
129
130
|
this.#internals.setFormValue(this.value);
|
|
130
131
|
this.#internals.setValidity({});
|
|
131
132
|
|
|
133
|
+
await Promise.resolve();
|
|
134
|
+
|
|
132
135
|
if (select.validationMessage) {
|
|
133
|
-
this.#internals.setValidity(
|
|
134
|
-
{ customError: true },
|
|
135
|
-
select.validationMessage,
|
|
136
|
-
select,
|
|
137
|
-
);
|
|
136
|
+
this.#internals.setValidity({ customError: true }, select.validationMessage, select);
|
|
138
137
|
}
|
|
139
138
|
}
|
|
140
139
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import '../link/link.element.js';
|
|
2
|
+
import './side-nav.element.js';
|
|
3
|
+
import './side-nav-item/side-nav-item.element.js';
|
|
4
4
|
|
|
5
|
-
import { assert, fixture, html } from
|
|
5
|
+
import { assert, fixture, html } from '@open-wc/testing';
|
|
6
6
|
|
|
7
|
-
import type { USASideNavElement } from
|
|
7
|
+
import type { USASideNavElement } from './side-nav.element.js';
|
|
8
8
|
|
|
9
|
-
describe(
|
|
10
|
-
it(
|
|
9
|
+
describe('usa-side-nav', () => {
|
|
10
|
+
it('should be accessible', async () => {
|
|
11
11
|
const sideNav = await fixture<USASideNavElement>(html`
|
|
12
12
|
<usa-side-nav>
|
|
13
13
|
<usa-side-nav-item current>
|
|
@@ -51,7 +51,7 @@ describe("usa-side-nav", () => {
|
|
|
51
51
|
return assert.isAccessible(sideNav);
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
-
it(
|
|
54
|
+
it('should set child padding correctly', async () => {
|
|
55
55
|
const sideNav = await fixture<USASideNavElement>(html`
|
|
56
56
|
<usa-side-nav>
|
|
57
57
|
<usa-side-nav-item current>
|
|
@@ -92,20 +92,10 @@ describe("usa-side-nav", () => {
|
|
|
92
92
|
</usa-side-nav>
|
|
93
93
|
`);
|
|
94
94
|
|
|
95
|
-
const items = sideNav.querySelectorAll(
|
|
96
|
-
|
|
97
|
-
assert.equal(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
),
|
|
101
|
-
"2rem",
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
assert.equal(
|
|
105
|
-
getComputedStyle(items[3]).getPropertyValue(
|
|
106
|
-
"--usa-nav-item-padding-left",
|
|
107
|
-
),
|
|
108
|
-
"3rem",
|
|
109
|
-
);
|
|
95
|
+
const items = sideNav.querySelectorAll('usa-side-nav-item');
|
|
96
|
+
|
|
97
|
+
assert.equal(getComputedStyle(items[1]).getPropertyValue('--usa-nav-item-padding-left'), '2rem');
|
|
98
|
+
|
|
99
|
+
assert.equal(getComputedStyle(items[3]).getPropertyValue('--usa-nav-item-padding-left'), '3rem');
|
|
110
100
|
});
|
|
111
101
|
});
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { attr, attrChanged, css, element, html } from
|
|
1
|
+
import { attr, attrChanged, css, element, html } from '@joist/element';
|
|
2
2
|
|
|
3
3
|
declare global {
|
|
4
4
|
interface HTMLElementTagNameMap {
|
|
5
|
-
|
|
5
|
+
'usa-step': USAStepIndicatorStepElement;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
@element({
|
|
10
|
-
tagName:
|
|
10
|
+
tagName: 'usa-step',
|
|
11
11
|
shadowDom: [
|
|
12
12
|
css`
|
|
13
13
|
:host {
|
|
@@ -42,26 +42,26 @@ declare global {
|
|
|
42
42
|
box-sizing: border-box;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
:host([state=
|
|
45
|
+
:host([state='complete']) {
|
|
46
46
|
color: #162e51;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
:host([state=
|
|
49
|
+
:host([state='complete'])::before {
|
|
50
50
|
background-color: #162e51;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
:host([state=
|
|
53
|
+
:host([state='current']) {
|
|
54
54
|
color: #005ea2;
|
|
55
55
|
font-weight: bold;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
:host([state=
|
|
58
|
+
:host([state='current'])::before {
|
|
59
59
|
background-color: #005ea2;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
:host:before {
|
|
63
63
|
background-color: #919191;
|
|
64
|
-
content:
|
|
64
|
+
content: '';
|
|
65
65
|
display: block;
|
|
66
66
|
height: 0.5rem;
|
|
67
67
|
}
|
|
@@ -78,19 +78,19 @@ declare global {
|
|
|
78
78
|
margin-top: 1.5rem;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
:host([counter][state=
|
|
81
|
+
:host([counter][state='complete']):after {
|
|
82
82
|
background-color: #162e51;
|
|
83
83
|
box-shadow: 0 0 0 0.25rem #fff;
|
|
84
84
|
color: #fff;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
:host([counter][state=
|
|
87
|
+
:host([counter][state='current']):after {
|
|
88
88
|
background-color: #005ea2;
|
|
89
89
|
box-shadow: 0 0 0 0.25rem #fff;
|
|
90
90
|
color: #fff;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
:host([counter=
|
|
93
|
+
:host([counter='small']):after {
|
|
94
94
|
height: 1.5rem;
|
|
95
95
|
width: 1.5rem;
|
|
96
96
|
font-size: 0.93rem;
|
|
@@ -109,15 +109,15 @@ declare global {
|
|
|
109
109
|
})
|
|
110
110
|
export class USAStepIndicatorStepElement extends HTMLElement {
|
|
111
111
|
@attr()
|
|
112
|
-
accessor state:
|
|
112
|
+
accessor state: 'complete' | 'current' | '' = '';
|
|
113
113
|
|
|
114
114
|
@attr()
|
|
115
|
-
accessor role =
|
|
115
|
+
accessor role = 'listitem';
|
|
116
116
|
|
|
117
|
-
@attrChanged(
|
|
117
|
+
@attrChanged('state')
|
|
118
118
|
onStateAttrChanged() {
|
|
119
|
-
if (this.state ===
|
|
120
|
-
this.ariaCurrent =
|
|
119
|
+
if (this.state === 'current') {
|
|
120
|
+
this.ariaCurrent = 'step';
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import './step-indicator.element.js';
|
|
2
|
+
import './step/step.element.js';
|
|
3
3
|
|
|
4
|
-
import { assert, fixture, html } from
|
|
4
|
+
import { assert, fixture, html } from '@open-wc/testing';
|
|
5
5
|
|
|
6
|
-
import type { USAStepIndicatorElement } from
|
|
6
|
+
import type { USAStepIndicatorElement } from './step-indicator.element.js';
|
|
7
7
|
|
|
8
|
-
describe(
|
|
9
|
-
it(
|
|
8
|
+
describe('usa-step-indicator', () => {
|
|
9
|
+
it('should be accessible', async () => {
|
|
10
10
|
const stepIndicator = await fixture<USAStepIndicatorElement>(html`
|
|
11
11
|
<usa-step-indicator>
|
|
12
12
|
<usa-step state="complete" counter="on">Personal information</usa-step>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import './summary-box.element.js';
|
|
2
|
+
|
|
3
|
+
import { assert, fixture, html } from '@open-wc/testing';
|
|
4
|
+
|
|
5
|
+
import type { USASummaryBoxElement } from './summary-box.element.js';
|
|
6
|
+
|
|
7
|
+
describe('usa-summary-box', () => {
|
|
8
|
+
it('should be accessible', async () => {
|
|
9
|
+
const summaryBox = await fixture<USASummaryBoxElement>(html` <usa-summary-box>Hello World</usa-summary-box> `);
|
|
10
|
+
|
|
11
|
+
return assert.isAccessible(summaryBox);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import './tag.element.js';
|
|
2
|
+
|
|
3
|
+
import { assert, fixture, html } from '@open-wc/testing';
|
|
4
|
+
|
|
5
|
+
import type { USATagElement } from './tag.element.js';
|
|
6
|
+
|
|
7
|
+
describe('usa-tag', () => {
|
|
8
|
+
it('should be accessible', async () => {
|
|
9
|
+
const tag = await fixture<USATagElement>(html` <usa-tag>Hello World</usa-tag> `);
|
|
10
|
+
|
|
11
|
+
return assert.isAccessible(tag);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import './textarea.element.js';
|
|
2
2
|
|
|
3
|
-
import { assert, fixture, html } from
|
|
4
|
-
import { userEvent } from
|
|
3
|
+
import { assert, fixture, html } from '@open-wc/testing';
|
|
4
|
+
import { userEvent } from '@testing-library/user-event';
|
|
5
5
|
|
|
6
|
-
describe(
|
|
7
|
-
it(
|
|
6
|
+
describe('usa-textarea', () => {
|
|
7
|
+
it('should be accessible', async () => {
|
|
8
8
|
const form = await fixture<HTMLFormElement>(html`
|
|
9
9
|
<usa-textarea name="fname" value="Foo">Hello World</usa-textarea>
|
|
10
10
|
`);
|
|
@@ -12,7 +12,7 @@ describe("usa-textarea", () => {
|
|
|
12
12
|
return assert.isAccessible(form);
|
|
13
13
|
});
|
|
14
14
|
|
|
15
|
-
it(
|
|
15
|
+
it('should submit form with default values', async () => {
|
|
16
16
|
const form = await fixture<HTMLFormElement>(html`
|
|
17
17
|
<form>
|
|
18
18
|
<usa-textarea name="fname" value="Foo">Hello World</usa-textarea>
|
|
@@ -23,10 +23,10 @@ describe("usa-textarea", () => {
|
|
|
23
23
|
|
|
24
24
|
const value = new FormData(form);
|
|
25
25
|
|
|
26
|
-
assert.equal(value.get(
|
|
26
|
+
assert.equal(value.get('fname'), 'Foo');
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
it(
|
|
29
|
+
it('should update form value as input value changed', async () => {
|
|
30
30
|
const form = await fixture<HTMLFormElement>(html`
|
|
31
31
|
<form>
|
|
32
32
|
<usa-textarea name="fname">Hello World</usa-textarea>
|
|
@@ -35,19 +35,19 @@ describe("usa-textarea", () => {
|
|
|
35
35
|
</form>
|
|
36
36
|
`);
|
|
37
37
|
|
|
38
|
-
const input = form.querySelector(
|
|
39
|
-
const nativeInput = input?.shadowRoot?.querySelector(
|
|
38
|
+
const input = form.querySelector('usa-textarea');
|
|
39
|
+
const nativeInput = input?.shadowRoot?.querySelector('textarea');
|
|
40
40
|
|
|
41
41
|
if (nativeInput) {
|
|
42
|
-
await userEvent.type(nativeInput,
|
|
42
|
+
await userEvent.type(nativeInput, 'Bar');
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
const value = new FormData(form);
|
|
46
46
|
|
|
47
|
-
assert.equal(value.get(
|
|
47
|
+
assert.equal(value.get('fname'), 'Bar');
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
-
it(
|
|
50
|
+
it('should not submit when not valid', async () => {
|
|
51
51
|
const form = await fixture<HTMLFormElement>(html`
|
|
52
52
|
<form>
|
|
53
53
|
<usa-textarea name="fname" required>Hello World</usa-textarea>
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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';
|
|
3
6
|
|
|
4
7
|
declare global {
|
|
5
8
|
interface HTMLElementTagNameMap {
|
|
@@ -59,11 +62,15 @@ declare global {
|
|
|
59
62
|
}
|
|
60
63
|
`,
|
|
61
64
|
html`
|
|
62
|
-
<
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
<j-bind attrs="for:name">
|
|
66
|
+
<label part="label">
|
|
67
|
+
<slot></slot>
|
|
68
|
+
</label>
|
|
69
|
+
</j-bind>
|
|
70
|
+
|
|
71
|
+
<j-bind props="name,placeholder,autocomplete,required,value,id:name">
|
|
72
|
+
<textarea id="textarea" part="textarea"></textarea>
|
|
73
|
+
</j-bind>
|
|
67
74
|
`,
|
|
68
75
|
],
|
|
69
76
|
})
|
|
@@ -71,48 +78,40 @@ export class USATextareaElement extends HTMLElement {
|
|
|
71
78
|
static formAssociated = true;
|
|
72
79
|
|
|
73
80
|
@attr()
|
|
81
|
+
@bind()
|
|
74
82
|
accessor name = '';
|
|
75
83
|
|
|
76
84
|
@attr()
|
|
85
|
+
@bind()
|
|
77
86
|
accessor autocomplete: AutoFill = 'on';
|
|
78
87
|
|
|
79
88
|
@attr()
|
|
89
|
+
@bind()
|
|
80
90
|
accessor placeholder = '';
|
|
81
91
|
|
|
82
92
|
@attr()
|
|
93
|
+
@bind()
|
|
83
94
|
accessor required = false;
|
|
84
95
|
|
|
96
|
+
@attr()
|
|
97
|
+
@bind()
|
|
98
|
+
accessor autofocus = false;
|
|
99
|
+
|
|
85
100
|
@attr({
|
|
86
101
|
reflect: false,
|
|
87
102
|
})
|
|
88
|
-
@
|
|
103
|
+
@bind()
|
|
89
104
|
accessor value = '';
|
|
90
105
|
|
|
91
106
|
#internals = this.attachInternals();
|
|
92
107
|
#input = query('textarea');
|
|
93
108
|
|
|
94
|
-
@ready()
|
|
95
|
-
onReady() {
|
|
96
|
-
this.#input({ autofocus: this.autofocus });
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
attributeChangedCallback() {
|
|
100
|
-
this.#input({
|
|
101
|
-
name: this.name,
|
|
102
|
-
placeholder: this.placeholder,
|
|
103
|
-
autocomplete: this.autocomplete,
|
|
104
|
-
required: this.required,
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
109
|
connectedCallback() {
|
|
109
110
|
this.#syncFormState();
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
@effect()
|
|
113
114
|
onChange() {
|
|
114
|
-
this.#input({ value: this.value });
|
|
115
|
-
|
|
116
115
|
this.#syncFormState();
|
|
117
116
|
}
|
|
118
117
|
|