@noctuatech/uswds 0.0.28 → 0.0.30
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/assets/uswds.min.js +1 -0
- package/package.json +1 -1
- package/src/lib/button/button.element.ts +24 -33
- package/src/lib/file-input/file-input-preview/file-input-preview.test.ts +2 -2
- package/src/lib/file-input/file-input.element.ts +58 -20
- package/src/lib/input/input.element.ts +39 -19
- package/src/lib/input/input.stories.ts +1 -1
- package/src/lib/textarea/textarea.element.ts +4 -1
- package/target/lib/accordion/accordion.element.d.ts +19 -0
- package/target/lib/accordion/accordion.element.js +166 -0
- package/target/lib/accordion/accordion.element.js.map +1 -0
- package/target/lib/accordion/accordion.stories.d.ts +12 -0
- package/target/lib/accordion/accordion.stories.js +42 -0
- package/target/lib/accordion/accordion.stories.js.map +1 -0
- package/target/lib/accordion/accordion.test.d.ts +1 -0
- package/target/lib/accordion/accordion.test.js +113 -0
- package/target/lib/accordion/accordion.test.js.map +1 -0
- package/target/lib/alert/alert-types.d.ts +7 -0
- package/target/lib/alert/alert-types.js +25 -0
- package/target/lib/alert/alert-types.js.map +1 -0
- package/target/lib/alert/alert.element.d.ts +11 -0
- package/target/lib/alert/alert.element.js +122 -0
- package/target/lib/alert/alert.element.js.map +1 -0
- package/target/lib/alert/alert.stories.d.ts +11 -0
- package/target/lib/alert/alert.stories.js +56 -0
- package/target/lib/alert/alert.stories.js.map +1 -0
- package/target/lib/alert/alert.test.d.ts +1 -0
- package/target/lib/alert/alert.test.js +20 -0
- package/target/lib/alert/alert.test.js.map +1 -0
- package/target/lib/button/button.element.d.ts +19 -0
- package/target/lib/button/button.element.js +253 -0
- package/target/lib/button/button.element.js.map +1 -0
- package/target/lib/button/button.stories.d.ts +12 -0
- package/target/lib/button/button.stories.js +22 -0
- package/target/lib/button/button.stories.js.map +1 -0
- package/target/lib/button/button.test.d.ts +1 -0
- package/target/lib/button/button.test.js +14 -0
- package/target/lib/button/button.test.js.map +1 -0
- package/target/lib/card/card-body/card-body.element.d.ts +7 -0
- package/target/lib/card/card-body/card-body.element.js +35 -0
- package/target/lib/card/card-body/card-body.element.js.map +1 -0
- package/target/lib/card/card-footer/card-footer.element.d.ts +7 -0
- package/target/lib/card/card-footer/card-footer.element.js +33 -0
- package/target/lib/card/card-footer/card-footer.element.js.map +1 -0
- package/target/lib/card/card-group/card-group.element.d.ts +8 -0
- package/target/lib/card/card-group/card-group.element.js +51 -0
- package/target/lib/card/card-group/card-group.element.js.map +1 -0
- package/target/lib/card/card-header/card-header.element.d.ts +7 -0
- package/target/lib/card/card-header/card-header.element.js +43 -0
- package/target/lib/card/card-header/card-header.element.js.map +1 -0
- package/target/lib/card/card-media/card-media.element.d.ts +8 -0
- package/target/lib/card/card-media/card-media.element.js +71 -0
- package/target/lib/card/card-media/card-media.element.js.map +1 -0
- package/target/lib/card/card.element.d.ts +9 -0
- package/target/lib/card/card.element.js +79 -0
- package/target/lib/card/card.element.js.map +1 -0
- package/target/lib/card/card.stories.d.ts +12 -0
- package/target/lib/card/card.stories.js +126 -0
- package/target/lib/card/card.stories.js.map +1 -0
- package/target/lib/card/card.test.d.ts +6 -0
- package/target/lib/card/card.test.js +33 -0
- package/target/lib/card/card.test.js.map +1 -0
- package/target/lib/checkbox/checkbox.element.d.ts +17 -0
- package/target/lib/checkbox/checkbox.element.js +206 -0
- package/target/lib/checkbox/checkbox.element.js.map +1 -0
- package/target/lib/checkbox/checkbox.stories.d.ts +31 -0
- package/target/lib/checkbox/checkbox.stories.js +46 -0
- package/target/lib/checkbox/checkbox.stories.js.map +1 -0
- package/target/lib/checkbox/checkbox.test.d.ts +1 -0
- package/target/lib/checkbox/checkbox.test.js +52 -0
- package/target/lib/checkbox/checkbox.test.js.map +1 -0
- package/target/lib/config/config.element.d.ts +6 -0
- package/target/lib/config/config.element.js +53 -0
- package/target/lib/config/config.element.js.map +1 -0
- package/target/lib/config/config.test.d.ts +1 -0
- package/target/lib/config/config.test.js +11 -0
- package/target/lib/config/config.test.js.map +1 -0
- package/target/lib/define.d.ts +32 -0
- package/target/lib/define.js +33 -0
- package/target/lib/define.js.map +1 -0
- package/target/lib/description/description.element.d.ts +7 -0
- package/target/lib/description/description.element.js +34 -0
- package/target/lib/description/description.element.js.map +1 -0
- package/target/lib/description/description.test.d.ts +1 -0
- package/target/lib/description/description.test.js +11 -0
- package/target/lib/description/description.test.js.map +1 -0
- package/target/lib/file-input/file-input-preview/file-input-preview.element.d.ts +12 -0
- package/target/lib/file-input/file-input-preview/file-input-preview.element.js +153 -0
- package/target/lib/file-input/file-input-preview/file-input-preview.element.js.map +1 -0
- package/target/lib/file-input/file-input-preview/file-input-preview.test.d.ts +2 -0
- package/target/lib/file-input/file-input-preview/file-input-preview.test.js +67 -0
- package/target/lib/file-input/file-input-preview/file-input-preview.test.js.map +1 -0
- package/target/lib/file-input/file-input.element.d.ts +19 -0
- package/target/lib/file-input/file-input.element.js +217 -0
- package/target/lib/file-input/file-input.element.js.map +1 -0
- package/target/lib/file-input/file-input.stories.d.ts +12 -0
- package/target/lib/file-input/file-input.stories.js +34 -0
- package/target/lib/file-input/file-input.stories.js.map +1 -0
- package/target/lib/file-input/file-input.test.d.ts +1 -0
- package/target/lib/file-input/file-input.test.js +37 -0
- package/target/lib/file-input/file-input.test.js.map +1 -0
- package/target/lib/icon/icon-types.d.ts +2 -0
- package/target/lib/icon/icon-types.js +262 -0
- package/target/lib/icon/icon-types.js.map +1 -0
- package/target/lib/icon/icon.element.d.ts +13 -0
- package/target/lib/icon/icon.element.js +72 -0
- package/target/lib/icon/icon.element.js.map +1 -0
- package/target/lib/icon/icon.stories.d.ts +12 -0
- package/target/lib/icon/icon.stories.js +39 -0
- package/target/lib/icon/icon.stories.js.map +1 -0
- package/target/lib/input/input.element.d.ts +25 -0
- package/target/lib/input/input.element.js +254 -0
- package/target/lib/input/input.element.js.map +1 -0
- package/target/lib/input/input.stories.d.ts +12 -0
- package/target/lib/input/input.stories.js +25 -0
- package/target/lib/input/input.stories.js.map +1 -0
- package/target/lib/input/input.test.d.ts +1 -0
- package/target/lib/input/input.test.js +50 -0
- package/target/lib/input/input.test.js.map +1 -0
- package/target/lib/input-mask/format.d.ts +15 -0
- package/target/lib/input-mask/format.js +47 -0
- package/target/lib/input-mask/format.js.map +1 -0
- package/target/lib/input-mask/input-mask.element.d.ts +12 -0
- package/target/lib/input-mask/input-mask.element.js +106 -0
- package/target/lib/input-mask/input-mask.element.js.map +1 -0
- package/target/lib/input-mask/input-mask.stories.d.ts +14 -0
- package/target/lib/input-mask/input-mask.stories.js +30 -0
- package/target/lib/input-mask/input-mask.stories.js.map +1 -0
- package/target/lib/input-mask/input-mask.test.d.ts +2 -0
- package/target/lib/input-mask/input-mask.test.js +89 -0
- package/target/lib/input-mask/input-mask.test.js.map +1 -0
- package/target/lib/input-mask/maskable.element.d.ts +5 -0
- package/target/lib/input-mask/maskable.element.js +2 -0
- package/target/lib/input-mask/maskable.element.js.map +1 -0
- package/target/lib/link/link.element.d.ts +13 -0
- package/target/lib/link/link.element.js +93 -0
- package/target/lib/link/link.element.js.map +1 -0
- package/target/lib/link/link.stories.d.ts +16 -0
- package/target/lib/link/link.stories.js +23 -0
- package/target/lib/link/link.stories.js.map +1 -0
- package/target/lib/modal/modal-close/modal-close.element.d.ts +8 -0
- package/target/lib/modal/modal-close/modal-close.element.js +76 -0
- package/target/lib/modal/modal-close/modal-close.element.js.map +1 -0
- package/target/lib/modal/modal-close/modal-close.test.d.ts +1 -0
- package/target/lib/modal/modal-close/modal-close.test.js +11 -0
- package/target/lib/modal/modal-close/modal-close.test.js.map +1 -0
- package/target/lib/modal/modal-heading/modal-heading.element.d.ts +7 -0
- package/target/lib/modal/modal-heading/modal-heading.element.js +50 -0
- package/target/lib/modal/modal-heading/modal-heading.element.js.map +1 -0
- package/target/lib/modal/modal-heading/modal-heading.test.d.ts +1 -0
- package/target/lib/modal/modal-heading/modal-heading.test.js +11 -0
- package/target/lib/modal/modal-heading/modal-heading.test.js.map +1 -0
- package/target/lib/modal/modal.element.d.ts +13 -0
- package/target/lib/modal/modal.element.js +91 -0
- package/target/lib/modal/modal.element.js.map +1 -0
- package/target/lib/modal/modal.stories.d.ts +12 -0
- package/target/lib/modal/modal.stories.js +34 -0
- package/target/lib/modal/modal.stories.js.map +1 -0
- package/target/lib/modal/modal.test.d.ts +3 -0
- package/target/lib/modal/modal.test.js +21 -0
- package/target/lib/modal/modal.test.js.map +1 -0
- package/target/lib/radio/context.d.ts +7 -0
- package/target/lib/radio/context.js +3 -0
- package/target/lib/radio/context.js.map +1 -0
- package/target/lib/radio/radio-option/radio-option.element.d.ts +12 -0
- package/target/lib/radio/radio-option/radio-option.element.js +89 -0
- package/target/lib/radio/radio-option/radio-option.element.js.map +1 -0
- package/target/lib/radio/radio-option/radio-option.test.d.ts +2 -0
- package/target/lib/radio/radio-option/radio-option.test.js +15 -0
- package/target/lib/radio/radio-option/radio-option.test.js.map +1 -0
- package/target/lib/radio/radio.element.d.ts +17 -0
- package/target/lib/radio/radio.element.js +169 -0
- package/target/lib/radio/radio.element.js.map +1 -0
- package/target/lib/radio/radio.stories.d.ts +17 -0
- package/target/lib/radio/radio.stories.js +46 -0
- package/target/lib/radio/radio.stories.js.map +1 -0
- package/target/lib/radio/radio.test.d.ts +2 -0
- package/target/lib/radio/radio.test.js +143 -0
- package/target/lib/radio/radio.test.js.map +1 -0
- package/target/lib/select/context.d.ts +6 -0
- package/target/lib/select/context.js +3 -0
- package/target/lib/select/context.js.map +1 -0
- package/target/lib/select/select-option/select-option.element.d.ts +14 -0
- package/target/lib/select/select-option/select-option.element.js +74 -0
- package/target/lib/select/select-option/select-option.element.js.map +1 -0
- package/target/lib/select/select.element.d.ts +17 -0
- package/target/lib/select/select.element.js +141 -0
- package/target/lib/select/select.element.js.map +1 -0
- package/target/lib/select/select.stories.d.ts +12 -0
- package/target/lib/select/select.stories.js +26 -0
- package/target/lib/select/select.stories.js.map +1 -0
- package/target/lib/select/select.test.d.ts +2 -0
- package/target/lib/select/select.test.js +105 -0
- package/target/lib/select/select.test.js.map +1 -0
- package/target/lib/services/http.service.d.ts +3 -0
- package/target/lib/services/http.service.js +24 -0
- package/target/lib/services/http.service.js.map +1 -0
- package/target/lib/services/icon.service.d.ts +4 -0
- package/target/lib/services/icon.service.js +60 -0
- package/target/lib/services/icon.service.js.map +1 -0
- package/target/lib/services/icon.service.test.d.ts +1 -0
- package/target/lib/services/icon.service.test.js +52 -0
- package/target/lib/services/icon.service.test.js.map +1 -0
- package/target/lib/side-nav/side-nav-item/side-nav-item.element.d.ts +8 -0
- package/target/lib/side-nav/side-nav-item/side-nav-item.element.js +107 -0
- package/target/lib/side-nav/side-nav-item/side-nav-item.element.js.map +1 -0
- package/target/lib/side-nav/side-nav.element.d.ts +8 -0
- package/target/lib/side-nav/side-nav.element.js +47 -0
- package/target/lib/side-nav/side-nav.element.js.map +1 -0
- package/target/lib/side-nav/side-nav.stories.d.ts +12 -0
- package/target/lib/side-nav/side-nav.stories.js +55 -0
- package/target/lib/side-nav/side-nav.stories.js.map +1 -0
- package/target/lib/side-nav/side-nav.test.d.ts +3 -0
- package/target/lib/side-nav/side-nav.test.js +93 -0
- package/target/lib/side-nav/side-nav.test.js.map +1 -0
- package/target/lib/step-indicator/step/step.element.d.ts +10 -0
- package/target/lib/step-indicator/step/step.element.js +151 -0
- package/target/lib/step-indicator/step/step.element.js.map +1 -0
- package/target/lib/step-indicator/step-indicator.element.d.ts +8 -0
- package/target/lib/step-indicator/step-indicator.element.js +48 -0
- package/target/lib/step-indicator/step-indicator.element.js.map +1 -0
- package/target/lib/step-indicator/step-indicator.stories.d.ts +21 -0
- package/target/lib/step-indicator/step-indicator.stories.js +45 -0
- package/target/lib/step-indicator/step-indicator.stories.js.map +1 -0
- package/target/lib/step-indicator/step-indicator.test.d.ts +2 -0
- package/target/lib/step-indicator/step-indicator.test.js +18 -0
- package/target/lib/step-indicator/step-indicator.test.js.map +1 -0
- package/target/lib/summary-box/summary-box.element.d.ts +7 -0
- package/target/lib/summary-box/summary-box.element.js +40 -0
- package/target/lib/summary-box/summary-box.element.js.map +1 -0
- package/target/lib/summary-box/summary-box.stories.d.ts +12 -0
- package/target/lib/summary-box/summary-box.stories.js +17 -0
- package/target/lib/summary-box/summary-box.stories.js.map +1 -0
- package/target/lib/summary-box/summary-box.test.d.ts +1 -0
- package/target/lib/summary-box/summary-box.test.js +11 -0
- package/target/lib/summary-box/summary-box.test.js.map +1 -0
- package/target/lib/tag/tag.element.d.ts +10 -0
- package/target/lib/tag/tag.element.js +57 -0
- package/target/lib/tag/tag.element.js.map +1 -0
- package/target/lib/tag/tag.stories.d.ts +19 -0
- package/target/lib/tag/tag.stories.js +25 -0
- package/target/lib/tag/tag.stories.js.map +1 -0
- package/target/lib/tag/tag.test.d.ts +1 -0
- package/target/lib/tag/tag.test.js +11 -0
- package/target/lib/tag/tag.test.js.map +1 -0
- package/target/lib/textarea/textarea.element.d.ts +19 -0
- package/target/lib/textarea/textarea.element.js +174 -0
- package/target/lib/textarea/textarea.element.js.map +1 -0
- package/target/lib/textarea/textarea.stories.d.ts +12 -0
- package/target/lib/textarea/textarea.stories.js +17 -0
- package/target/lib/textarea/textarea.stories.js.map +1 -0
- package/target/lib/textarea/textarea.test.d.ts +1 -0
- package/target/lib/textarea/textarea.test.js +50 -0
- package/target/lib/textarea/textarea.test.js.map +1 -0
- package/target/lib.d.ts +32 -0
- package/target/lib.js +33 -0
- package/target/lib.js.map +1 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
import { attr, css, element, html } from "@joist/element";
|
|
3
|
+
let USACardElement = (() => {
|
|
4
|
+
let _classDecorators = [element({
|
|
5
|
+
tagName: "usa-card",
|
|
6
|
+
shadowDom: [
|
|
7
|
+
css `
|
|
8
|
+
:host {
|
|
9
|
+
color: #1b1b1b;
|
|
10
|
+
background-color: #fff;
|
|
11
|
+
font-size: 1.06rem;
|
|
12
|
+
line-height: 1.5;
|
|
13
|
+
border-width: 2px;
|
|
14
|
+
border-color: #e6e6e6;
|
|
15
|
+
border-style: solid;
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
position: relative;
|
|
19
|
+
border-radius: 0.25rem;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
:host([variant="flag"]) {
|
|
23
|
+
padding-left: 15rem;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
:host([variant="flag"]) ::slotted(usa-card-media) {
|
|
27
|
+
position: absolute;
|
|
28
|
+
bottom: 0;
|
|
29
|
+
top: 0;
|
|
30
|
+
left: 0;
|
|
31
|
+
width: 15rem;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:host([variant="flag"]) ::slotted(usa-card-media[variant="inset"]) {
|
|
35
|
+
padding-bottom: 1.5rem;
|
|
36
|
+
padding-right: 0;
|
|
37
|
+
}
|
|
38
|
+
`,
|
|
39
|
+
html `<slot></slot>`,
|
|
40
|
+
],
|
|
41
|
+
})];
|
|
42
|
+
let _classDescriptor;
|
|
43
|
+
let _classExtraInitializers = [];
|
|
44
|
+
let _classThis;
|
|
45
|
+
let _classSuper = HTMLElement;
|
|
46
|
+
let _role_decorators;
|
|
47
|
+
let _role_initializers = [];
|
|
48
|
+
let _role_extraInitializers = [];
|
|
49
|
+
let _variant_decorators;
|
|
50
|
+
let _variant_initializers = [];
|
|
51
|
+
let _variant_extraInitializers = [];
|
|
52
|
+
var USACardElement = class extends _classSuper {
|
|
53
|
+
static { _classThis = this; }
|
|
54
|
+
static {
|
|
55
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
56
|
+
_role_decorators = [attr()];
|
|
57
|
+
_variant_decorators = [attr()];
|
|
58
|
+
__esDecorate(this, null, _role_decorators, { kind: "accessor", name: "role", static: false, private: false, access: { has: obj => "role" in obj, get: obj => obj.role, set: (obj, value) => { obj.role = value; } }, metadata: _metadata }, _role_initializers, _role_extraInitializers);
|
|
59
|
+
__esDecorate(this, null, _variant_decorators, { kind: "accessor", name: "variant", static: false, private: false, access: { has: obj => "variant" in obj, get: obj => obj.variant, set: (obj, value) => { obj.variant = value; } }, metadata: _metadata }, _variant_initializers, _variant_extraInitializers);
|
|
60
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
61
|
+
USACardElement = _classThis = _classDescriptor.value;
|
|
62
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
63
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
64
|
+
}
|
|
65
|
+
#role_accessor_storage = __runInitializers(this, _role_initializers, "listitem");
|
|
66
|
+
get role() { return this.#role_accessor_storage; }
|
|
67
|
+
set role(value) { this.#role_accessor_storage = value; }
|
|
68
|
+
#variant_accessor_storage = (__runInitializers(this, _role_extraInitializers), __runInitializers(this, _variant_initializers, "default"));
|
|
69
|
+
get variant() { return this.#variant_accessor_storage; }
|
|
70
|
+
set variant(value) { this.#variant_accessor_storage = value; }
|
|
71
|
+
constructor() {
|
|
72
|
+
super(...arguments);
|
|
73
|
+
__runInitializers(this, _variant_extraInitializers);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
return USACardElement = _classThis;
|
|
77
|
+
})();
|
|
78
|
+
export { USACardElement };
|
|
79
|
+
//# sourceMappingURL=card.element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.element.js","sourceRoot":"","sources":["../../../src/lib/card/card.element.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;IA8C7C,cAAc;4BAtC1B,OAAO,CAAC;YACP,OAAO,EAAE,UAAU;YACnB,SAAS,EAAE;gBACT,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+BF;gBACD,IAAI,CAAA,eAAe;aACpB;SACF,CAAC;;;;sBACkC,WAAW;;;;;;;8BAAnB,SAAQ,WAAW;;;;gCAC5C,IAAI,EAAE;mCAGN,IAAI,EAAE;YAFP,iKAAS,IAAI,6BAAJ,IAAI,mFAAc;YAG3B,0KAAS,OAAO,6BAAP,OAAO,yFAAiC;YALnD,6KAMC;;;YANY,uDAAc;;QAEzB,qEAAgB,UAAU,EAAC;QAA3B,IAAS,IAAI,0CAAc;QAA3B,IAAS,IAAI,gDAAc;QAG3B,8HAAuC,SAAS,GAAC;QAAjD,IAAS,OAAO,6CAAiC;QAAjD,IAAS,OAAO,mDAAiC;;;;;;;;SALtC,cAAc"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/web-components";
|
|
2
|
+
import type { USACardElement } from "./card.element.js";
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
tags: string[];
|
|
6
|
+
argTypes: {};
|
|
7
|
+
args: {};
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<USACardElement>;
|
|
11
|
+
export declare const Primary: Story;
|
|
12
|
+
export declare const Flag: Story;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { html } from "lit";
|
|
2
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
3
|
+
const meta = {
|
|
4
|
+
title: "usa-card",
|
|
5
|
+
tags: ["autodocs"],
|
|
6
|
+
argTypes: {},
|
|
7
|
+
args: {},
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
11
|
+
export const Primary = {
|
|
12
|
+
render() {
|
|
13
|
+
return html `
|
|
14
|
+
<usa-card-group>
|
|
15
|
+
<usa-card>
|
|
16
|
+
<usa-card-header>Card</usa-card-header>
|
|
17
|
+
|
|
18
|
+
<usa-card-body>
|
|
19
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Facilis
|
|
20
|
+
earum tenetur quo cupiditate, eaque qui officia recusandae.
|
|
21
|
+
</usa-card-body>
|
|
22
|
+
|
|
23
|
+
<usa-card-footer>
|
|
24
|
+
<usa-button>Visit Florida Keys</usa-button>
|
|
25
|
+
</usa-card-footer>
|
|
26
|
+
</usa-card>
|
|
27
|
+
|
|
28
|
+
<usa-card>
|
|
29
|
+
<usa-card-media>
|
|
30
|
+
<img src="./img/built-to-grow--alt.jpg" alt="A placeholder image" />
|
|
31
|
+
</usa-card-media>
|
|
32
|
+
|
|
33
|
+
<usa-card-header>Card with media</usa-card-header>
|
|
34
|
+
|
|
35
|
+
<usa-card-body>
|
|
36
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Facilis
|
|
37
|
+
earum tenetur quo cupiditate, eaque qui officia recusandae.
|
|
38
|
+
</usa-card-body>
|
|
39
|
+
|
|
40
|
+
<usa-card-footer>
|
|
41
|
+
<usa-button>Visit Florida Keys</usa-button>
|
|
42
|
+
</usa-card-footer>
|
|
43
|
+
</usa-card>
|
|
44
|
+
|
|
45
|
+
<usa-card>
|
|
46
|
+
<usa-card-header>Media with heaer first</usa-card-header>
|
|
47
|
+
|
|
48
|
+
<usa-card-media>
|
|
49
|
+
<img src="./img/built-to-grow--alt.jpg" alt="A placeholder image" />
|
|
50
|
+
</usa-card-media>
|
|
51
|
+
|
|
52
|
+
<usa-card-body>
|
|
53
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Tempore
|
|
54
|
+
possimus similique nemo odit doloremque laudantium?
|
|
55
|
+
</usa-card-body>
|
|
56
|
+
|
|
57
|
+
<usa-card-footer>
|
|
58
|
+
<usa-button>Visit Florida Keys</usa-button>
|
|
59
|
+
</usa-card-footer>
|
|
60
|
+
</usa-card>
|
|
61
|
+
|
|
62
|
+
<usa-card>
|
|
63
|
+
<usa-card-media variant="inset">
|
|
64
|
+
<img src="./img/built-to-grow--alt.jpg" alt="A placeholder image" />
|
|
65
|
+
</usa-card-media>
|
|
66
|
+
|
|
67
|
+
<usa-card-header>Inset media</usa-card-header>
|
|
68
|
+
|
|
69
|
+
<usa-card-body>
|
|
70
|
+
Etiam vitae sodales metus. Fusce id orci dignissim, efficitur risus
|
|
71
|
+
eget, tempus odio. Donec lectus ante, auctor eget cursus sed,
|
|
72
|
+
convallis quis magna. Orci varius natoque penatibus et magnis dis
|
|
73
|
+
parturient montes, nascetur ridiculus mus. Mauris mattis tellus
|
|
74
|
+
bibendum aliquet malesuada.
|
|
75
|
+
</usa-card-body>
|
|
76
|
+
|
|
77
|
+
<usa-card-footer>
|
|
78
|
+
<usa-button>Visit Florida Keys</usa-button>
|
|
79
|
+
</usa-card-footer>
|
|
80
|
+
</usa-card>
|
|
81
|
+
</usa-card-group>
|
|
82
|
+
`;
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
export const Flag = {
|
|
86
|
+
render() {
|
|
87
|
+
return html `
|
|
88
|
+
<usa-card-group variant="flag">
|
|
89
|
+
<usa-card variant="flag">
|
|
90
|
+
<usa-card-media>
|
|
91
|
+
<img src="./img/built-to-grow--alt.jpg" alt="A placeholder image" />
|
|
92
|
+
</usa-card-media>
|
|
93
|
+
|
|
94
|
+
<usa-card-header>Card with media</usa-card-header>
|
|
95
|
+
|
|
96
|
+
<usa-card-body>
|
|
97
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Facilis
|
|
98
|
+
earum tenetur quo cupiditate, eaque qui officia recusandae.
|
|
99
|
+
</usa-card-body>
|
|
100
|
+
|
|
101
|
+
<usa-card-footer>
|
|
102
|
+
<usa-button>Visit Florida Keys</usa-button>
|
|
103
|
+
</usa-card-footer>
|
|
104
|
+
</usa-card>
|
|
105
|
+
|
|
106
|
+
<usa-card variant="flag">
|
|
107
|
+
<usa-card-media variant="inset">
|
|
108
|
+
<img src="./img/built-to-grow--alt.jpg" alt="A placeholder image" />
|
|
109
|
+
</usa-card-media>
|
|
110
|
+
|
|
111
|
+
<usa-card-header>Card with media</usa-card-header>
|
|
112
|
+
|
|
113
|
+
<usa-card-body>
|
|
114
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Facilis
|
|
115
|
+
earum tenetur quo cupiditate, eaque qui officia recusandae.
|
|
116
|
+
</usa-card-body>
|
|
117
|
+
|
|
118
|
+
<usa-card-footer>
|
|
119
|
+
<usa-button>Visit Florida Keys</usa-button>
|
|
120
|
+
</usa-card-footer>
|
|
121
|
+
</usa-card>
|
|
122
|
+
</usa-card-group>
|
|
123
|
+
`;
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
//# sourceMappingURL=card.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.stories.js","sourceRoot":"","sources":["../../../src/lib/card/card.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAI3B,kFAAkF;AAClF,MAAM,IAAI,GAAG;IACX,KAAK,EAAE,UAAU;IACjB,IAAI,EAAE,CAAC,UAAU,CAAC;IAElB,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE,EAAE;CACsB,CAAC;AAEjC,eAAe,IAAI,CAAC;AAIpB,wFAAwF;AACxF,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,MAAM;QACJ,OAAO,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqEV,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAU;IACzB,MAAM;QACJ,OAAO,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAoCV,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import "./card.element.js";
|
|
2
|
+
import "./card-body/card-body.element.js";
|
|
3
|
+
import "./card-footer/card-footer.element.js";
|
|
4
|
+
import "./card-group/card-group.element.js";
|
|
5
|
+
import "./card-header/card-header.element.js";
|
|
6
|
+
import "./card-media/card-media.element.js";
|
|
7
|
+
import { assert, fixture, html } from "@open-wc/testing";
|
|
8
|
+
describe("usa-card", () => {
|
|
9
|
+
it("should be accessible", async () => {
|
|
10
|
+
const card = await fixture(html `
|
|
11
|
+
<usa-card-group>
|
|
12
|
+
<usa-card>
|
|
13
|
+
<usa-card-media>
|
|
14
|
+
<img src="/img/built-to-grow--alt.jpg" alt="A placeholder image" />
|
|
15
|
+
</usa-card-media>
|
|
16
|
+
|
|
17
|
+
<usa-card-header>Card with media</usa-card-header>
|
|
18
|
+
|
|
19
|
+
<usa-card-body>
|
|
20
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Facilis
|
|
21
|
+
earum tenetur quo cupiditate, eaque qui officia recusandae.
|
|
22
|
+
</usa-card-body>
|
|
23
|
+
|
|
24
|
+
<usa-card-footer>
|
|
25
|
+
<usa-button>Visit Florida Keys</usa-button>
|
|
26
|
+
</usa-card-footer>
|
|
27
|
+
</usa-card>
|
|
28
|
+
</usa-card-group>
|
|
29
|
+
`);
|
|
30
|
+
return assert.isAccessible(card);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=card.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.test.js","sourceRoot":"","sources":["../../../src/lib/card/card.test.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC;AAC3B,OAAO,kCAAkC,CAAC;AAC1C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,oCAAoC,CAAC;AAC5C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,oCAAoC,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAIzD,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,EAAE,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE;QACpC,MAAM,IAAI,GAAG,MAAM,OAAO,CAAiB,IAAI,CAAA;;;;;;;;;;;;;;;;;;;KAmB9C,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface HTMLElementTagNameMap {
|
|
3
|
+
"usa-checkbox": USACheckboxElement;
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
export declare class USACheckboxElement extends HTMLElement {
|
|
7
|
+
#private;
|
|
8
|
+
static formAssociated: boolean;
|
|
9
|
+
accessor checked: boolean;
|
|
10
|
+
accessor name: string;
|
|
11
|
+
accessor value: string;
|
|
12
|
+
accessor required: boolean;
|
|
13
|
+
accessor tiled: boolean;
|
|
14
|
+
connectedCallback(): void;
|
|
15
|
+
attributeChangedCallback(): void;
|
|
16
|
+
onCheckboxChange(): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
import { attr, css, element, html, listen, query } from "@joist/element";
|
|
3
|
+
let USACheckboxElement = (() => {
|
|
4
|
+
let _classDecorators = [element({
|
|
5
|
+
tagName: "usa-checkbox",
|
|
6
|
+
shadowDom: [
|
|
7
|
+
css `
|
|
8
|
+
* {
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
:host {
|
|
13
|
+
display: inline-block;
|
|
14
|
+
max-width: 30rem;
|
|
15
|
+
position: relative;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:host([tiled]) label {
|
|
19
|
+
background-color: #fff;
|
|
20
|
+
border: 2px solid #c9c9c9;
|
|
21
|
+
border-radius: 0.25rem;
|
|
22
|
+
color: #1b1b1b;
|
|
23
|
+
padding: 0.75rem 1rem 0.75rem 0.75rem;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
label {
|
|
27
|
+
display: inline-flex;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
font-size: 1.06rem;
|
|
30
|
+
line-height: 1.3;
|
|
31
|
+
flex-wrap: wrap;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.checkbox {
|
|
35
|
+
background: #fff;
|
|
36
|
+
box-shadow: 0 0 0 2px #1b1b1b;
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
height: 1.25rem;
|
|
41
|
+
width: 1.25rem;
|
|
42
|
+
border-radius: 2px;
|
|
43
|
+
position: relative;
|
|
44
|
+
margin-right: 0.75rem;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
input:checked + .checkbox {
|
|
48
|
+
background-color: #005ea2;
|
|
49
|
+
box-shadow: 0 0 0 2px #005ea2;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
input:checked + .checkbox::after {
|
|
53
|
+
content: " ";
|
|
54
|
+
display: block;
|
|
55
|
+
height: 1rem;
|
|
56
|
+
width: 0.5rem;
|
|
57
|
+
border-right: 4px solid rgb(255, 255, 255);
|
|
58
|
+
border-bottom: 4px solid rgb(255, 255, 255);
|
|
59
|
+
transform: rotate(45deg) scale(0.65);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
input {
|
|
63
|
+
position: absolute;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
input:focus + .checkbox {
|
|
67
|
+
outline: 0.25rem solid #2491ff;
|
|
68
|
+
outline-offset: 0.25rem;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.description {
|
|
72
|
+
display: block;
|
|
73
|
+
font-size: 0.93rem;
|
|
74
|
+
margin-top: 0.5rem;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.break {
|
|
78
|
+
flex-basis: 100%;
|
|
79
|
+
height: 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.spacer {
|
|
83
|
+
height: 1.25rem;
|
|
84
|
+
width: 1.25rem;
|
|
85
|
+
margin-right: 0.75rem;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
:host([tiled]) label:has(input:checked) {
|
|
89
|
+
background-color: rgba(0, 94, 162, 0.1);
|
|
90
|
+
border-color: #005ea2;
|
|
91
|
+
}
|
|
92
|
+
`,
|
|
93
|
+
html `
|
|
94
|
+
<label>
|
|
95
|
+
<input type="checkbox" tabindex="0"/>
|
|
96
|
+
|
|
97
|
+
<div class="checkbox"></div>
|
|
98
|
+
|
|
99
|
+
<div class="title">
|
|
100
|
+
<slot></slot>
|
|
101
|
+
</div>
|
|
102
|
+
</label>
|
|
103
|
+
`,
|
|
104
|
+
],
|
|
105
|
+
})];
|
|
106
|
+
let _classDescriptor;
|
|
107
|
+
let _classExtraInitializers = [];
|
|
108
|
+
let _classThis;
|
|
109
|
+
let _classSuper = HTMLElement;
|
|
110
|
+
let _instanceExtraInitializers = [];
|
|
111
|
+
let _checked_decorators;
|
|
112
|
+
let _checked_initializers = [];
|
|
113
|
+
let _checked_extraInitializers = [];
|
|
114
|
+
let _name_decorators;
|
|
115
|
+
let _name_initializers = [];
|
|
116
|
+
let _name_extraInitializers = [];
|
|
117
|
+
let _value_decorators;
|
|
118
|
+
let _value_initializers = [];
|
|
119
|
+
let _value_extraInitializers = [];
|
|
120
|
+
let _required_decorators;
|
|
121
|
+
let _required_initializers = [];
|
|
122
|
+
let _required_extraInitializers = [];
|
|
123
|
+
let _tiled_decorators;
|
|
124
|
+
let _tiled_initializers = [];
|
|
125
|
+
let _tiled_extraInitializers = [];
|
|
126
|
+
let _onCheckboxChange_decorators;
|
|
127
|
+
var USACheckboxElement = class extends _classSuper {
|
|
128
|
+
static { _classThis = this; }
|
|
129
|
+
static {
|
|
130
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
131
|
+
_checked_decorators = [attr()];
|
|
132
|
+
_name_decorators = [attr()];
|
|
133
|
+
_value_decorators = [attr()];
|
|
134
|
+
_required_decorators = [attr()];
|
|
135
|
+
_tiled_decorators = [attr({
|
|
136
|
+
observed: false,
|
|
137
|
+
})];
|
|
138
|
+
_onCheckboxChange_decorators = [listen("change", "input[type=checkbox]")];
|
|
139
|
+
__esDecorate(this, null, _checked_decorators, { kind: "accessor", name: "checked", static: false, private: false, access: { has: obj => "checked" in obj, get: obj => obj.checked, set: (obj, value) => { obj.checked = value; } }, metadata: _metadata }, _checked_initializers, _checked_extraInitializers);
|
|
140
|
+
__esDecorate(this, null, _name_decorators, { kind: "accessor", name: "name", static: false, private: false, access: { has: obj => "name" in obj, get: obj => obj.name, set: (obj, value) => { obj.name = value; } }, metadata: _metadata }, _name_initializers, _name_extraInitializers);
|
|
141
|
+
__esDecorate(this, null, _value_decorators, { kind: "accessor", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
|
|
142
|
+
__esDecorate(this, null, _required_decorators, { kind: "accessor", name: "required", static: false, private: false, access: { has: obj => "required" in obj, get: obj => obj.required, set: (obj, value) => { obj.required = value; } }, metadata: _metadata }, _required_initializers, _required_extraInitializers);
|
|
143
|
+
__esDecorate(this, null, _tiled_decorators, { kind: "accessor", name: "tiled", static: false, private: false, access: { has: obj => "tiled" in obj, get: obj => obj.tiled, set: (obj, value) => { obj.tiled = value; } }, metadata: _metadata }, _tiled_initializers, _tiled_extraInitializers);
|
|
144
|
+
__esDecorate(this, null, _onCheckboxChange_decorators, { kind: "method", name: "onCheckboxChange", static: false, private: false, access: { has: obj => "onCheckboxChange" in obj, get: obj => obj.onCheckboxChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
145
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
146
|
+
USACheckboxElement = _classThis = _classDescriptor.value;
|
|
147
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
148
|
+
}
|
|
149
|
+
static formAssociated = true;
|
|
150
|
+
#checked_accessor_storage = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _checked_initializers, false));
|
|
151
|
+
get checked() { return this.#checked_accessor_storage; }
|
|
152
|
+
set checked(value) { this.#checked_accessor_storage = value; }
|
|
153
|
+
#name_accessor_storage = (__runInitializers(this, _checked_extraInitializers), __runInitializers(this, _name_initializers, ""));
|
|
154
|
+
get name() { return this.#name_accessor_storage; }
|
|
155
|
+
set name(value) { this.#name_accessor_storage = value; }
|
|
156
|
+
#value_accessor_storage = (__runInitializers(this, _name_extraInitializers), __runInitializers(this, _value_initializers, ""));
|
|
157
|
+
get value() { return this.#value_accessor_storage; }
|
|
158
|
+
set value(value) { this.#value_accessor_storage = value; }
|
|
159
|
+
#required_accessor_storage = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _required_initializers, false));
|
|
160
|
+
get required() { return this.#required_accessor_storage; }
|
|
161
|
+
set required(value) { this.#required_accessor_storage = value; }
|
|
162
|
+
#tiled_accessor_storage = (__runInitializers(this, _required_extraInitializers), __runInitializers(this, _tiled_initializers, false));
|
|
163
|
+
get tiled() { return this.#tiled_accessor_storage; }
|
|
164
|
+
set tiled(value) { this.#tiled_accessor_storage = value; }
|
|
165
|
+
#checkbox = (__runInitializers(this, _tiled_extraInitializers), query("input"));
|
|
166
|
+
#internals = this.attachInternals();
|
|
167
|
+
connectedCallback() {
|
|
168
|
+
const checkbox = this.#checkbox();
|
|
169
|
+
checkbox.checked = this.checked;
|
|
170
|
+
checkbox.name = this.name;
|
|
171
|
+
this.#syncFormState();
|
|
172
|
+
}
|
|
173
|
+
attributeChangedCallback() {
|
|
174
|
+
const checkbox = this.#checkbox();
|
|
175
|
+
checkbox.checked = this.checked;
|
|
176
|
+
checkbox.name = this.name;
|
|
177
|
+
this.#syncFormState();
|
|
178
|
+
}
|
|
179
|
+
onCheckboxChange() {
|
|
180
|
+
const checkbox = this.#checkbox();
|
|
181
|
+
this.checked = checkbox.checked;
|
|
182
|
+
this.#syncFormState();
|
|
183
|
+
}
|
|
184
|
+
#syncFormState() {
|
|
185
|
+
const checkbox = this.#checkbox();
|
|
186
|
+
if (checkbox.checked) {
|
|
187
|
+
this.#internals.setFormValue(this.value);
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
this.#internals.setFormValue(null);
|
|
191
|
+
}
|
|
192
|
+
if (this.required && !checkbox.checked) {
|
|
193
|
+
this.#internals.setValidity({ valueMissing: true }, "Please check this box if you want to proceed", this.#checkbox());
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
this.#internals.setValidity({});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
static {
|
|
200
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
return USACheckboxElement = _classThis;
|
|
204
|
+
})();
|
|
205
|
+
export { USACheckboxElement };
|
|
206
|
+
//# sourceMappingURL=checkbox.element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.element.js","sourceRoot":"","sources":["../../../src/lib/checkbox/checkbox.element.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/web-components";
|
|
2
|
+
import type { USACheckboxElement } from "./checkbox.element.js";
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
tags: string[];
|
|
6
|
+
render(args: USACheckboxElement & {
|
|
7
|
+
description: string;
|
|
8
|
+
}): import("lit-html").TemplateResult<1>;
|
|
9
|
+
argTypes: {
|
|
10
|
+
name: {
|
|
11
|
+
control: "text";
|
|
12
|
+
};
|
|
13
|
+
value: {
|
|
14
|
+
control: "text";
|
|
15
|
+
};
|
|
16
|
+
description: {
|
|
17
|
+
control: "text";
|
|
18
|
+
};
|
|
19
|
+
tiled: {
|
|
20
|
+
control: "boolean";
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
args: {
|
|
24
|
+
name: string;
|
|
25
|
+
value: string;
|
|
26
|
+
tiled: false;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export default meta;
|
|
30
|
+
type Story = StoryObj<USACheckboxElement>;
|
|
31
|
+
export declare const Primary: Story;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { html } from "lit";
|
|
2
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
3
|
+
import { when } from "lit/directives/when.js";
|
|
4
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
5
|
+
const meta = {
|
|
6
|
+
title: "usa-checkbox",
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
render(args) {
|
|
9
|
+
return html `
|
|
10
|
+
<usa-checkbox
|
|
11
|
+
name=${args.name}
|
|
12
|
+
value=${ifDefined(args.value)}
|
|
13
|
+
checked=${ifDefined(args.checked)}
|
|
14
|
+
?tiled=${args.tiled}
|
|
15
|
+
>
|
|
16
|
+
Hello World
|
|
17
|
+
${when(args.description, () => html `<usa-description>${args.description}</usa-description>`)}
|
|
18
|
+
</usa-checkbox>
|
|
19
|
+
`;
|
|
20
|
+
},
|
|
21
|
+
argTypes: {
|
|
22
|
+
name: {
|
|
23
|
+
control: "text",
|
|
24
|
+
},
|
|
25
|
+
value: {
|
|
26
|
+
control: "text",
|
|
27
|
+
},
|
|
28
|
+
description: {
|
|
29
|
+
control: "text",
|
|
30
|
+
},
|
|
31
|
+
tiled: {
|
|
32
|
+
control: "boolean",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
args: {
|
|
36
|
+
name: "toc",
|
|
37
|
+
value: "agree",
|
|
38
|
+
tiled: false,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
export default meta;
|
|
42
|
+
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
43
|
+
export const Primary = {
|
|
44
|
+
args: {},
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=checkbox.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.stories.js","sourceRoot":"","sources":["../../../src/lib/checkbox/checkbox.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAE3B,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAI9C,kFAAkF;AAClF,MAAM,IAAI,GAAG;IACX,KAAK,EAAE,cAAc;IACrB,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,MAAM,CAAC,IAAI;QACT,OAAO,IAAI,CAAA;;eAEA,IAAI,CAAC,IAAI;gBACR,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;kBACnB,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC;iBACxB,IAAI,CAAC,KAAK;;;UAGjB,IAAI,CACJ,IAAI,CAAC,WAAW,EAChB,GAAG,EAAE,CAAC,IAAI,CAAA,oBAAoB,IAAI,CAAC,WAAW,oBAAoB,CACnE;;KAEJ,CAAC;IACJ,CAAC;IACD,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,OAAO,EAAE,MAAM;SAChB;QACD,KAAK,EAAE;YACL,OAAO,EAAE,MAAM;SAChB;QACD,WAAW,EAAE;YACX,OAAO,EAAE,MAAM;SAChB;QACD,KAAK,EAAE;YACL,OAAO,EAAE,SAAS;SACnB;KACF;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,KAAK;QACX,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,KAAK;KACb;CAC2D,CAAC;AAE/D,eAAe,IAAI,CAAC;AAIpB,wFAAwF;AACxF,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,IAAI,EAAE,EAAE;CACT,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./checkbox.element.js";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import "./checkbox.element.js";
|
|
2
|
+
import { assert, fixture, html } from "@open-wc/testing";
|
|
3
|
+
describe("usa-checkbox", () => {
|
|
4
|
+
it("should be accessible", async () => {
|
|
5
|
+
const form = await fixture(html `
|
|
6
|
+
<usa-checkbox name="fname" value="Foo">Hello World</usa-checkbox>
|
|
7
|
+
`);
|
|
8
|
+
return assert.isAccessible(form);
|
|
9
|
+
});
|
|
10
|
+
it("should submit form with default values", async () => {
|
|
11
|
+
const form = await fixture(html `
|
|
12
|
+
<form>
|
|
13
|
+
<usa-checkbox name="enabled" value="test" checked>
|
|
14
|
+
Hello World
|
|
15
|
+
</usa-checkbox>
|
|
16
|
+
|
|
17
|
+
<button>Submit</button>
|
|
18
|
+
</form>
|
|
19
|
+
`);
|
|
20
|
+
const value = new FormData(form);
|
|
21
|
+
assert.equal(value.get("enabled"), "test");
|
|
22
|
+
});
|
|
23
|
+
it("should update form value as input value changed", async () => {
|
|
24
|
+
const form = await fixture(html `
|
|
25
|
+
<form>
|
|
26
|
+
<usa-checkbox name="enabled" value="test">Hello World</usa-checkbox>
|
|
27
|
+
|
|
28
|
+
<button>Submit</button>
|
|
29
|
+
</form>
|
|
30
|
+
`);
|
|
31
|
+
const checkbox = form.querySelector("usa-checkbox");
|
|
32
|
+
const nativeInput = checkbox?.shadowRoot?.querySelector("input");
|
|
33
|
+
if (nativeInput) {
|
|
34
|
+
nativeInput.click();
|
|
35
|
+
}
|
|
36
|
+
const value = new FormData(form);
|
|
37
|
+
assert.equal(value.get("enabled"), "test");
|
|
38
|
+
});
|
|
39
|
+
it("should not submit when not valid", async () => {
|
|
40
|
+
const form = await fixture(html `
|
|
41
|
+
<form>
|
|
42
|
+
<usa-checkbox name="enabled" value="test" required>
|
|
43
|
+
Hello World
|
|
44
|
+
</usa-checkbox>
|
|
45
|
+
|
|
46
|
+
<button>Submit</button>
|
|
47
|
+
</form>
|
|
48
|
+
`);
|
|
49
|
+
assert.equal(form.checkValidity(), false);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=checkbox.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.test.js","sourceRoot":"","sources":["../../../src/lib/checkbox/checkbox.test.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEzD,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE;QACpC,MAAM,IAAI,GAAG,MAAM,OAAO,CAAkB,IAAI,CAAA;;KAE/C,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wCAAwC,EAAE,KAAK,IAAI,EAAE;QACtD,MAAM,IAAI,GAAG,MAAM,OAAO,CAAkB,IAAI,CAAA;;;;;;;;KAQ/C,CAAC,CAAC;QAEH,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEjC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iDAAiD,EAAE,KAAK,IAAI,EAAE;QAC/D,MAAM,IAAI,GAAG,MAAM,OAAO,CAAkB,IAAI,CAAA;;;;;;KAM/C,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QACpD,MAAM,WAAW,GAAG,QAAQ,EAAE,UAAU,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;QAEjE,IAAI,WAAW,EAAE,CAAC;YAChB,WAAW,CAAC,KAAK,EAAE,CAAC;QACtB,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEjC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kCAAkC,EAAE,KAAK,IAAI,EAAE;QAChD,MAAM,IAAI,GAAG,MAAM,OAAO,CAAkB,IAAI,CAAA;;;;;;;;KAQ/C,CAAC,CAAC;QAEH,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|